Hi guys,

I have a windows form frm1 that calls another form frm2 by the following code:

this.hide();
                frm2 new_frm2 = new frm2();               
                new_frm2.ShowDialog();
                this.Close();

it takes about 5 sec for the frm2 to show so I'd like to use waitcursor. I found that the waitcursor can only appear when the mouse is within boundary of the application form. However, since I hide frm1 before frm2 is shown and it takes 5 sec to show frm2, bascially there is nothing displayed from my application during this 5 sec, therefore the windows just focus on whatever is behind my application and turn the cursor according to that.
Is there any way to turn the cursor for the entire windows operating system to a waitcursor, so no matter where the mouse is, the cursor is always a waitCursor?

Thank you very much

There probably is a way to change the global cursor, but it's probably not a good idea. I would be pretty angry if an app (I probably paid for) hijacked my cursor throughout all of windows. Have you considered a loading screen with a progress bar? This is a non-intrusive way to tell the user that you are doing something.

If you are sure you want to do this for whatever reason, you can create a form the size of the whole screen and make it transparent. This would mean people can't interface with other apps since they would just be clicking on your form (unless, say in the on_click event you minimize it but that would just get ugly).

Here's some code to make a transparent form the size of the screen and use the wait cursor in it:

this.BackColor = Color.FromKnownColor(KnownColor.Control);
            this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.Bounds = System.Windows.Forms.Screen.PrimaryScreen.Bounds;
            this.TransparencyKey = Color.FromKnownColor(KnownColor.Control);
            this.Cursor = Cursors.WaitCursor;
            this.Update();

There probably is a way to change the global cursor, but it's probably not a good idea. I would be pretty angry if an app (I probably paid for) hijacked my cursor throughout all of windows. Have you considered a loading screen with a progress bar? This is a non-intrusive way to tell the user that you are doing something.

If you are sure you want to do this for whatever reason, you can create a form the size of the whole screen and make it transparent. This would mean people can't interface with other apps since they would just be clicking on your form (unless, say in the on_click event you minimize it but that would just get ugly).

Here's some code to make a transparent form the size of the screen and use the wait cursor in it:

this.BackColor = Color.FromKnownColor(KnownColor.Control);
            this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.Bounds = System.Windows.Forms.Screen.PrimaryScreen.Bounds;
            this.TransparencyKey = Color.FromKnownColor(KnownColor.Control);
            this.Cursor = Cursors.WaitCursor;
            this.Update();

Thank you! skatamatic

I guess you are right. I'll use a progress bar instead.

Please mark this thread as solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.