Private Declare Function Chord Lib "gdi32.dll" _
(ByVal hdc As Long, ByVal nLeftRect As Long, ByVal nTopRect As Long, _
ByVal nRightRect As Long, ByVal nBottomRect As Long, _
ByVal nXRadial1 As Long, ByVal nYRadial1 As Long, _
ByVal nXRadial2 As Long, ByVal nYRadial2 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 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 lpRect As RECT, hbr As Long, hOld 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)
hbr = CreateSolidBrush(RGB(255, 161, 192))
hOld = SelectObject(.hdc, hbr)
.ForeColor = vbRed
Call Chord(.hdc, 10, 10, .ScaleWidth - 10, .ScaleHeight - 10, _
(.ScaleWidth - 20) / 2 + 10, 10, .ScaleWidth - 10, (.ScaleHeight - 20) / 2 + 10)
Call SelectObject(.hdc, hOld)
Call DeleteObject(hbr)
End With
End Sub |