Hi Kevin,
I am sorry for misunderstanding your meaning.
I think the Cursor.Current is used to set the current cursor only when the
message loop is stopped.
e.g. In the senario below, the message loop will stop because it is busy
running Button1_Click function, so after we set the Cursor.Current =
Cursors.WaitCursor it will keep the Cursors.WaitCursor.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Cursor.Current = Cursors.WaitCursor
For i As Long = 0 To 1000000000000
Dim j As Long = i
Next
Cursor.Current = Cursors.Default
End Sub
While the Cursor you refer to in your second statement means the Cursor
property of a control, it may be a window form or another control.
e.g.
If we set the Cursor property of winform as below, if we move the cursor
over windows forms area, the cursor will became Cursors.WaitCursor, while
it will become Cursors.Default if we move the cursor on a control whose
Cursor property is Cursors.Default even if it is on the windows form.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.Cursor = Cursors.WaitCursor
End Sub
As for the problem that when we set the listview's Cursor property to
Cursors.WaitCursor, the cursor will not change when mouse moves over the
listview, that is a known issue.
So far as a workaround, we need to derived ourselves' listview and override
the wndproc to set the cursor.
Here is the sample code.
Imports System.Runtime.InteropServices
Public Class MyListView
Inherits ListView
Const WM_SETCURSOR = &H20
Public Declare Function SetCursor Lib "user32" Alias "SetCursor" (ByVal
hCursor As IntPtr) As IntPtr
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
if m.Msg = WM_SETCURSOR
SetCursor(Me.Cursor.Handle)
Return
End If
MyBase.WndProc(m)
End Sub
End Class
You may have a try and let me know the result.
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.