Unusual cursor behavior with ListView.MouseDown

  • Thread starter Douglas Richard
  • Start date

Douglas Richard

I have a simple Windows Forms application that consists of two forms,
Form1 and Form2. Form1 contains only a single ListView control, with
the following MouseDown event handler:

Private Sub ListView1_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseDown
Dim frm As New Form2
End Sub

Form2 contains a TextBox and a Button (set as the form's AcceptButton).
When the ListView on Form1 is clicked, the MouseDown event fires
normally and Form2 is displayed. If I then type some text into the
TextBox control on Form2 such that the cursor hides itself, then hit
the 'Enter' key to trigger the Button and close the form, Form2 closes
and focus returns to Form1, but the cursor remains hidden! It is only
hidden when over my application, and a click or a call to Cursor.Show
makes it visible again.

Other cursor properties can similarly get "stuck". If the cursor is
moved over the text of the TextBox so that it changes to an I-beam, and
the form is then closed through the Enter key, the cursor will retain
the I-beam icon.

The problem only seems to occur when launching another form from a
ListView.MouseDown event handler; other standard controls seem to be
fine, and ListView.MouseUp event works fine.

Have others run into this? Is it a bug or intendeded behavior?


I've seen this with many different applications, managed and unmanaged alike.

It think its a Windows thing. There's a setting with most mouse drivers
"Hide pointer when typing". I think when the mouse is hidden, mouse cursor
changes are ignored; but I haven't spent any time trying to confirm this.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question