Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hrgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Integer, ByVal Y1 As Integer, ByVal X2 As Integer, ByVal Y2 As Integer, ByVal X3 As Integer, ByVal Y3 As Integer) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
Private Declare Function CreatePen Lib "gdi32" (ByVal nPenStyle As Long, ByVal nWidth As Long, ByVal crColor As Long) As Long
Private Declare Function RoundRect Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
Private Const PS_SOLID = 0
Private Sub Form_Load()
Form1.ScaleMode = 3
Dim i As Long
Dim pen As Long
i = CreatePen(PS_SOLID, 1, RGB(234, 3, 45))
pen = SelectObject(Me.hdc, i)
Dim hrgn As Long
hrgn = CreateRoundRectRgn(2, 2, Text1.Width - 1, Text1.Height - 1, 10, 10)
SetWindowRgn Text1.hWnd, hrgn, True
DeleteObject hrgn
RoundRect Me.hdc, Text1.Left, Text1.Top, Text1.Left + Text1.Width, Text1.Height + Text1.Top, 10, 10
SelectObject Me.hdc, pen
DeleteObject i
End Sub