[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?
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:
Quote:
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...