|
-
Jan 15th, 2013, 11:11 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] Can't set Owner-Drawn Button MousePointer as HandPointer
I had studied all kinds of Owner-Drawn ActiveX Button control like JCButton,LavolopButton,CandyButton on PSC.com, but none of them got Mouse Icon work properly.If I set MousePointer as handpointer, the icon was flashing (Arrow and Hand) when mouse moving around. What is the solution?
Owner-drawn button uc normally did like:
Private Enum CURSOR_RESOURCE
OCR_NORMAL = 32512&
OCR_IBEAM = 32513&
OCR_WAIT = 32514&
OCR_CROSS = 32515&
OCR_UP = 32516&
OCR_SIZE = 32640&
OCR_ICON = 32641&
OCR_SIZENWSE = 32642&
OCR_SIZENESW = 32643&
OCR_SIZEWE = 32644&
OCR_SIZENS = 32645&
OCR_SIZEALL = 32646&
OCR_ICOCUR = 32647&
OCR_NO = 32648&
OCR_HAND = 32649&
OCR_APPSTARTING = 32650&
End Enum
Private Sub UserControl_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
SetCursor LoadCursor(0, OCR_HAND)
'..
End Sub
Private Sub UserControl_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
SetCursor LoadCursor(0, OCR_HAND )
'..
End Sub
Private Sub UserControl_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
SetCursor LoadCursor(0, OCR_HAND )
'..
End Sub
Private Sub UserControl_DblClick()
SetCursor LoadCursor(0, OCR_HAND )
'..
End Sub
-
Jan 15th, 2013, 07:01 PM
#2
Re: Can't set Owner-Drawn Button MousePointer as HandPointer
You'll have to handle the WM_SETCURSOR message in the subclass procedure.
Code:
Case WM_SETCURSOR
If UserControl.MousePointer = vbCustom Then
SetCursor LoadCursor(0&, OCR_HAND) 'Load any cursor you like
SubclassProc = -True
Exit Function
End If
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
-
Jan 15th, 2013, 07:21 PM
#3
Thread Starter
Frenzied Member
Re: Can't set Owner-Drawn Button MousePointer as HandPointer
Thank you. Subclass works.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|