Private Declare Function Arc Lib "gdi32.dll" (ByVal hdc As Long, _
ByVal nLeftRect As Long, ByVal nTopRect As Long, ByVal nRightRect As Long, _
ByVal nBottomRect As Long, ByVal nXStartArc As Long, ByVal nYStartArc As Long, _
ByVal nXEndArc As Long, ByVal nYEndArc As Long) As Long
Private Declare Function MoveToEx Lib "gdi32.dll" _
(ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpCoord As Long) As Long
Private Type RECT
x As Long
y As Long
dx As Long
dy As Long
End Type
Private Declare Function FrameRect Lib "user32.dll" _
(ByVal hdc As Long, lpRect As RECT, ByVal hbr 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 lpRect As RECT, hbr As Long
With Me.Picture1
.BackColor = vbWhite
lpRect.x = 10
lpRect.y = 10
lpRect.dx = .ScaleWidth - 10
lpRect.dy = .ScaleHeight - 10
hbr = CreateSolidBrush(RGB(180, 180, 180))
Call FrameRect(.hdc, lpRect, hbr)
Call DeleteObject(hbr)
.ForeColor = vbRed
Call Arc(.hdc, 10, 10, .ScaleWidth - 10, .ScaleHeight - 10, _
(.ScaleWidth - 20) / 2 + 10, 10, .ScaleWidth - 10, (.ScaleHeight - 20) / 2 + 10)
End With
End Sub |