470,586 Members | 1,349 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,586 developers. It's quick & easy.

ListView Cursor changing & flickering

179 100+
I'm trying to change the cursor that appears on a standard ListView when the cursor appears over an item. However I am getting a flickering effect as the mouse is changed to a finger cursor, and then back to what I asked it to be.

I'm trying to isolate this flicker/changing to the hand cursor but can't figure out where it's occuring or how to stop it. To replicate this...

1) Create a form with a ListView on it.
2) Add an image list and some images. Set the view to the large icon mode.
3) Add some items to the ListView.

Add a MouseMove event to the ListView:

Expand|Select|Wrap|Line Numbers
  1.       private void listView1_MouseMove(object sender, MouseEventArgs e)
  2.         {
  3.             ListViewItem selected = this.listView1.GetItemAt(e.X, e.Y);
  4.             if (selected == null)
  5.             {
  6.                 base.Cursor = Cursors.Default;
  7.             }
  8.             else
  9.             {
  10.                 base.Cursor = Cursors.No;
  11.             }
  12.         }
Execute the app, moving the mouse over an item. You should see the cursor flickering between the No (no entry cursor) and the finger pointer when you're over an item. The question is how to ensure it just displays the No cursor and to not flicker. (C# .NET).

I've tried override both OnMouseMove and OnMouseHover to returning to ensure these don't set anything. I've also tried overriding the Cursor property and saying 'only set to default or no cursors' and that didn't work either.

Any help's appreciated.

Feb 27 '09 #1
0 1741

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by Joaquin Grech | last post: by
9 posts views Thread by C# Learner | last post: by
2 posts views Thread by John Lee | last post: by
2 posts views Thread by John Lee | last post: by
3 posts views Thread by Steve Long | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.