Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7936381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:11:53+00:00 2026-06-03T22:11:53+00:00

I have a WinForms application with a user control in which I change the

  • 0

I have a WinForms application with a user control in which I change the cursor dynamically based on its location. I create my custom cursors as static members of the user control, like this:

private static Cursor _openHandCursor = new Cursor( Properties.Resources.openHand.Handle );

Then in the OnMouseMove override I set the appropriate cursor, like this:

this.Cursor = <some condition> ? _openHandCursor : Cursors.Default;

When I start the application, it works correctly. However, after a couple of cursor changes (around 20) it sticks with the default (arrow) bitmap and does not change any more. But the oddest thing is that after this happens, I check the Handle property of the current Cursor value and it is equal to the handle of the _openHandCursor object! So it seems the value of the property is still being set correctly but the cursor bitmap on the screen doesn’t get updated. Any suggestions about this weird behaviour?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T22:11:55+00:00Added an answer on June 3, 2026 at 10:11 pm

    Change

    private static Cursor _openHandCursor = new Cursor( Properties.Resources.openHand.Handle );
    

    to

    private static Cursor _openHandCursor = Properties.Resources.openHand;
    

    When you create Cursor object (new Cursor (<Handle>)), it just reuses the same handle as cursor from resources.
    Since you don’t store reference to original cursor (created by Properties.Resources.openHand.Handle property getter), it is going to be garbage collected.
    Cursor class defines finalizer, which destroys handle by calling DestroyCursor(), making it invalid. Now Cursor, which you created, has the same handle, but it does not know that handle is not valid anymore.
    OS just uses default cursor when you try to set an invalid one.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a winforms application. i have a user control with a lot of
In my WinForms application, I have a WebBrowser control which displays a page. When
I got a .net WinForms application. I have a UserControl which gets instantiated based
I have a WinForms application with a view where the user selects a single
I have developed a C# WinForms application whereby the user is providing input via
I have a WinForms application with a DataGridView control and a column of DataGridViewButtonCell
We have a WinForms application which runs on a touch-screen on a bit of
I have a WinForms application in which I have hosted a web page inside
I am making Winforms application. I have put gridview in usercontrol. Which is another
I have a WinForms application with some business objects which implement INotifyPropertyChanged and hook

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.