How to clear Cursor.Clip in C # and let the cursor move freely?

I am trying to lock the cursor in the form, this is the application for the drawer for the drawer, I am trying to remove the cursor so that it will reset Cursor.Clipwhen it unlocks it.

So far, I:

Cursor.Clip = new Rectangle(x +8, y +30, Size.Width -16, Size.Height -38);

It works great.

But I can’t figure out how to clear the clip when they unlock it. I tried Cursor.Dispose();But this does not work.

Any ideas? Thanks.

+3
source share
3 answers

Set Clipto Rectanglewhich contains screen sizes.

Cursor.Clip = Screen.PrimaryScreen.Bounds;

Of course, this will not work with dual monitor settings, but you get this idea.

+1
source

,

Cursor.Clip = new Rectangle();

.

+9

: Cursor.Clip . , reset , .

: , VB.NET Cursor.Clip=Nothing. , Rectangle null. , #, , Cursor.Clip=Rectangle.Empty Cursor.Clip=default(Rectangle)?

+1

Source: https://habr.com/ru/post/1724031/


All Articles