Private Declare Function RoundRect Lib "gdi32.dll" _
(ByVal hdc As Long, ByVal nLeftRect As Long, ByVal nTopRect As Long, _
ByVal nRightRect As Long, ByVal nBottomRect As Long, _
ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Function SelectObject Lib "gdi32.dll" _
(ByVal hdc As Long, ByVal hgdiobj As Long) As Long
Private Declare Function DeleteObject Lib "gdi32.dll" (ByVal hObject As Long) As Long
Private Declare Function CreateSolidBrush Lib "gdi32.dll" _
(ByVal crColor As Long) As Long
Private Sub Form_Load()
Me.Picture1.ScaleMode = 3
End Sub
Private Sub Picture1_Paint()
Dim hbr As Long, hOld As Long
With Me.Picture1
.BackColor = vbWhite
.ForeColor = vbRed
hbr = CreateSolidBrush(RGB(240, 255, 140))
hOld = SelectObject(.hdc, hbr)
Call RoundRect(.hdc, 30, 30, .ScaleWidth - 60, .ScaleHeight - 60, 20, 20)
Call SelectObject(.hdc, hOld)
Call DeleteObject(hbr)
End With
End Sub |