Код:
- Код: Выделить всё
Private Declare Function Rectangle Lib "gdi32" (ByVal hdc As Long, ByVal x1 As Long, ByVal y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) 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 DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Dim xq1 As Single, yq1 As Single
Dim mBrush As Long, hRPen As Long
Private Sub Form_Load()
Picture1.AutoRedraw = True
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
xq1 = x / 15
yq1 = y / 15
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 1 Then
mBrush = CreateSolidBrush(crNewColor)
SelectObject Picture1.hdc, mBrush
Rectangle Picture1.hdc, xq1, yq1, x / 15, y / 15
DeleteObject mBrush
Picture1.Refresh
End If
End Sub
Большая часть, как вы понимаете, была вырезана из Api-Guide... мне к сожалению, этот механизм не очень понятен Спасибо!