자료실

부자는 돈을 써서 시간을 아끼지만 가난한 사람은 시간을 써서 돈을 아낀다

vb.net

IT HUB를 찾아주셔서 감사합니다.

기타 [vb.net] 원문자 넣기 -> 한글 1자, 숫자 0~99, 영대 1자, 영소 2자

페이지 정보

profile_image
작성자 하나를하더라도최선을
댓글 0건 조회 6,994회 작성일 22-09-06 16:49

본문

bf9a2aee65d76b4c7186a636a1f7e7d8_1662450404_3074.png



    Private Sub TextBox3_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBox3.KeyDown
        If e.KeyCode <> 13 Then Return
        Dim P As New PictureBox
        P.Size = New Size(5050)
        P.BackColor = Color.Transparent
        Dim bmp As Bitmap = New Bitmap(P.Width, P.Height)
        bmp.MakeTransparent()
        Dim G As Graphics = Graphics.FromImage(bmp) '// P.CreateGraphics()
        Dim drawString As String = TextBox3.Text
        Dim drawFont As Font = New Font("맑은 고딕"22, FontStyle.Bold)
        Dim drawBrush As SolidBrush = New SolidBrush(Color.Red)
        Dim x As Single = 1.0F, y As Single = 1.0F
        Dim drawFormat As StringFormat = New StringFormat()
        drawFormat.FormatFlags = TextFormatFlags.HorizontalCenter Or TextFormatFlags.VerticalCenter Or TextFormatFlags.WordBreak
        drawFormat.Alignment = StringAlignment.Center
        Dim drawRect As New RectangleF(x, y + 3, P.Width - (x * 2), P.Height - (y * 2))
        G.DrawString(drawString, drawFont, drawBrush, drawRect, drawFormat)
        Dim rect As Rectangle = New Rectangle(11, P.Width - 4, P.Height - 4)
        Dim myPen As Pen = New Pen(Color.Red, 4)
        G.DrawEllipse(myPen, rect)
        P.Location = New Point(2525)
        picCanvas.Controls.Add(P)
        P.BringToFront() : P.Visible = True : P.Enabled = True
        P.Image = bmp
        AddHandler P.MouseDown, Sub(ByVal pic As PictureBox, ByVal pMe As MouseEventArgs)
                                    Dim mx = Control.MousePosition.X - pic.Location.X
                                    Dim my = Control.MousePosition.Y - pic.Location.Y
                                    pic.Tag = New Point(mx, my)
                                End Sub
        AddHandler P.MouseMove, Sub(ByVal pic As PictureBox, ByVal pMe As MouseEventArgs)
                                    If pMe.Button = Windows.Forms.MouseButtons.Left Then
                                        Dim startPoint As Point = DirectCast(pic.Tag, Point)
                                        Dim mPoint As Point = Control.MousePosition
                                        mPoint.X -= startPoint.X
                                        mPoint.Y -= startPoint.Y
                                        pic.Location = mPoint
                                    End If
                                End Sub
        AddHandler P.MouseUp, Sub(ByVal pic As PictureBox, ByVal pMe As MouseEventArgs)
                              End Sub
        AddHandler P.MouseDoubleClick, Sub(ByVal pic As PictureBox, ByVal pMe As MouseEventArgs)
                                           pic.Parent.Controls.Remove(pic)
                                       End Sub
    End Sub


댓글목록

등록된 댓글이 없습니다.