none
How to change mouse pointer in C#?

    Question

  • Hi,
    How to change mouse pointer scheme in C#?
    (Mouse Pointer scheme can be found in ControlPanel->Mouse->Pointers tab->Scheme)
    Is there any api Available?
    Please give some samples?
    ALso is there any way to get available Schemes in the ComboBOx List?

    Regards, Anandakumar.R
    Tuesday, September 01, 2009 7:24 AM

Answers

  • Okay, you have to change them in registry: HKEY_current_user\Control panel\Cursors\

    and then you should inform the system of it see for a VB example at:

    http://social.msdn.microsoft.com/forums/en-US/vbgeneral/thread/a0b5d97f-a9dd-448f-9a6a-fc2836f4f7df

    Searching little further: http://msdn.microsoft.com/en-us/library/ms724947%28VS.85%29.aspx

    At the bottom is the C# definition for the function.
    [DllImport("user32.dll", EntryPoint = "SystemParametersInfo")]
    public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, uint pvParam, uint fWinIni);

    • Edited by boothwine Tuesday, September 01, 2009 9:30 AM Added library reference
    • Marked as answer by Bin-ze Zhao Friday, September 04, 2009 5:12 AM
    Tuesday, September 01, 2009 9:24 AM

All replies

  • comboBox1.Cursor=Cursors.Hand;

    or =Cursors.Arrow;

    ...
    family as water
    Tuesday, September 01, 2009 7:32 AM
  • Here a sample, I have the cursor as a bitmap in resource.

            private Cursor HandClosed;

    In Contstructor of my form:
                // Create custom cursors
                Bitmap test = Properties.Resources.HandClose;
                test.MakeTransparent(Color.Fuchsia);
                HandClosed = new Cursor(test.GetHicon());

    And I use it on a panel, this line is in a mouse move event, because I change the cursor depending on its postion:

    panel4.Cursor = HandClosed;

    Hopefully this helps.
    Tuesday, September 01, 2009 7:33 AM
  • Hi,
    Sorry guys..Thanks for you reply.
    I dont mean to change cursor in my application or particular panel
    I want to change cursor in entire OS itself. Like what  do u do in Controlpanel.
    My all other cursor like busy etc should change accordingly.

    Thats y i am expecting some APIs?
    Thanks..

    Regards, Anandakumar.R
    Tuesday, September 01, 2009 8:52 AM
  • Okay, you have to change them in registry: HKEY_current_user\Control panel\Cursors\

    and then you should inform the system of it see for a VB example at:

    http://social.msdn.microsoft.com/forums/en-US/vbgeneral/thread/a0b5d97f-a9dd-448f-9a6a-fc2836f4f7df

    Searching little further: http://msdn.microsoft.com/en-us/library/ms724947%28VS.85%29.aspx

    At the bottom is the C# definition for the function.
    [DllImport("user32.dll", EntryPoint = "SystemParametersInfo")]
    public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, uint pvParam, uint fWinIni);

    • Edited by boothwine Tuesday, September 01, 2009 9:30 AM Added library reference
    • Marked as answer by Bin-ze Zhao Friday, September 04, 2009 5:12 AM
    Tuesday, September 01, 2009 9:24 AM
  • Hi, it's an old thread but i need it. I'm trying to change my cursor in Window through a WPF application. It seem i have to change the registry to have it work out of the application. So i try this code but i don't see what parameter put for int pvParam.

    On this thread it seem it's 'null' (http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/977e2f40-3222-4e13-90ea-4e8d0cdf289c/) but Visual studio told ma that he can't convert <null> to uint. So i'm lost and i don't know what to do.

    Wednesday, February 29, 2012 10:39 AM