Results 1 to 2 of 2

Thread: [RESOLVED] [02/03] Listview Cursor

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2005
    Posts
    384

    Resolved [RESOLVED] [02/03] Listview Cursor

    Hello everyone.
    I'm trying to set my Listview's cursor to Hand. I got this class (after searching here and google), but, nothing changes, my Listview cursor does not change. here is my code:
    Code:
    Imports System.Windows.Forms
    Public Class GLVHeader
        Inherits NativeWindow
    
        Private WithEvents mList As ListView
    
        Private mHandle As IntPtr
        Declare Function SendMessageW Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr
    
        Private Const LVM_FIRST As Integer = &H1000
        Private Const LVM_GETHEADER As Integer = LVM_FIRST + 31
        Private Const WM_SETCURSOR As Integer = &H20
    
        Public Sub New(ByVal view As ListView)
            mList = view
            mHandle = SendMessageW(view.Handle, LVM_GETHEADER, IntPtr.Zero, IntPtr.Zero)
            If Not mHandle.Equals(IntPtr.Zero) Then Me.AssignHandle(mHandle)
        End Sub
    
        Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
            If m.Msg <> WM_SETCURSOR Then MyBase.WndProc(m)
        End Sub
    
        Private Sub mList_HandleDestroyed(ByVal sender As Object, ByVal e As System.EventArgs) Handles mList.handleDestroyed
            If Not mHandle.Equals(IntPtr.Zero) Then Me.ReleaseHandle()
            mHandle = IntPtr.Zero
        End Sub
    
    
    End Class
    And here is how I implement this class into my form:
    Code:
        Private Sub lvGenie_HandleCreated(ByVal sender As Object, ByVal e As System.EventArgs) Handles lvGenie.HandleCreated
            Dim headerControl As GLVHeader = New GLVHeader(ListView1)
    
        End Sub
    
        Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
              ListView1.Cursor = Cursors.Hand
        End Sub
    can anyone help me identify what is wrong?

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [02/03] Listview Cursor

    while its not really in a great spot (IMO) if you look at the .NET 2.0 documentation for the ListView, you will see this:

    Setting the Cursor property for a ListView control has no affect on the appearance of the cursor in .NET Framework versions 1.1 and earlier.
    http://msdn2.microsoft.com/en-us/lib...ew(vs.80).aspx

    Why they didn't put that information in the 1.1 documentation is beyond me...

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