ну, по-моему, чудесная прога - API-Guide:
- Private Type RECT
- Left As Long
- Top As Long
- Right As Long
- Bottom As Long
- End Type
- Private Type POINTAPI
- X As Long
- Y As Long
- End Type
-
- Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
- Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
- Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
- Sub DrawButton(Pushed As Boolean)
- Dim Clr1 As Long, Clr2 As Long
- If Pushed = True Then
-
- Clr1 = &H808080
-
- Clr2 = &HFFFFFF
- ElseIf Pushed = False Then
-
- Clr1 = &HFFFFFF
-
- Clr2 = &H808080
- End If
-
- With Form1.ExplButton
-
- Form1.ExplButton.Line (0, 0)-(.ScaleWidth, 0), Clr1
- Form1.ExplButton.Line (0, 0)-(0, .ScaleHeight), Clr1
- Form1.ExplButton.Line (.ScaleWidth - 1, .ScaleHeight - 1)-(.ScaleWidth - 1, 0), Clr2
- Form1.ExplButton.Line (.ScaleWidth - 1, .ScaleHeight - 1)-(0, .ScaleHeight - 1), Clr2
- End With
- End Sub
- Private Sub Command1_Click()
- Dim Rec As RECT
-
- GetWindowRect Form1.hwnd, Rec
-
- SetCursorPos Rec.Right - 15, Rec.Top + 15
- End Sub
- Private Sub ExplButton_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
- DrawButton True
- End Sub
- Private Sub ExplButton_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
- DrawButton False
- End Sub
- Private Sub ExplButton_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
- DrawButton False
- End Sub
- Private Sub Form_Load()
-
-
-
-
- Dim Stretched As Boolean
-
-
- picIcon.ScaleMode = vbPixels
-
- ExplButton.BorderStyle = 0
-
- ExplButton.ScaleMode = vbPixels
-
- ExplButton.AutoRedraw = True
-
- Me.ScaleMode = vbPixels
-
- Command1.Caption = "Set Mousecursor on X"
-
-
-
- Stretched = False
-
- If Stretched = True Then
-
- ExplButton.PaintPicture picIcon.Picture, 1, 1, ExplButton.ScaleWidth - 2, ExplButton.ScaleHeight - 2
- ElseIf Stretched = False Then
-
- ExplButton.PaintPicture picIcon.Picture, (ExplButton.ScaleWidth - picIcon.ScaleWidth) / 2, (ExplButton.ScaleHeight - picIcon.ScaleHeight) / 2
- End If
-
- ExplButton.Picture = ExplButton.Image
- End Sub
- Private Sub Timer1_Timer()
- Dim Rec As RECT, Point As POINTAPI
-
- GetWindowRect Me.hwnd, Rec
-
- GetCursorPos Point
-
-
- If Point.X >= Rec.Left And Point.X <= Rec.Right And Point.Y >= Rec.Top And Point.Y <= Rec.Bottom Then
- Me.Caption = "MouseCursor is on form."
- Else
-
- Me.Caption = "MouseCursor is not on form."
- End If
- End Sub
- Private Sub Timer2_Timer()
- Dim Rec As RECT, Point As POINTAPI
-
- GetWindowRect ExplButton.hwnd, Rec
-
- GetCursorPos Point
-
- If Point.X < Rec.Left Or Point.X > Rec.Right Or Point.Y < Rec.Top Or Point.Y > Rec.Bottom Then ExplButton.Cls
- End Sub
Ответить
|