Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Mouse.OverrideCursor and this.Cursor

Tags:

c#

wpf

What is the difference between using

Mouse.OverrideCursor = Cursors.Wait

and

this.Cursor = Cursors.Wait.

which one is correct ?
As I am using WPF and C#.

like image 403
janakiakula Avatar asked Jul 27 '12 11:07

janakiakula


People also ask

What is cursor in dot net?

A cursor in Windows is an icon that is displayed when you move a mouse, a pen, or a trackball. Usually, a different cursor image is displayed for different activity. For instance, the default cursor is different than a wait cursor. Cursors may be different for different operating systems.

How to change mouse pointer in c#?

The primary way to change the mouse pointer is by setting the Control. Cursor or DefaultCursor property of a control to a new Cursor. For examples of changing the mouse pointer, see the code example in the Cursor class.


1 Answers

The main difference is that Mouse.OverrideCursor will set the mouse cursor for the whole application while this.Cursor will set it only for that specific FrameworkElement.

So it will depend what you want to do.

If you want to show the wait cursor for the entire application use Mouse.OverrideCursor, but if you only want to show the wait cursor over a specific part of the application use this.Cursor.

like image 74
Adrian Fâciu Avatar answered Nov 15 '22 17:11

Adrian Fâciu