Results 1 to 3 of 3

Thread: [RESOLVED] Can't set Owner-Drawn Button MousePointer as HandPointer

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2010
    Posts
    1,103

    Resolved [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

  2. #2
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,057

    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)

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2010
    Posts
    1,103

    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
  •  



Click Here to Expand Forum to Full Width