Você está na página 1de 4

Cursor.Clip Property (System.Windows.

Forms)

United States - English

Dropdown Arrow

Microsoft.com

Welcome Sign in

Submit Query

Web

.NET Framework Developer Center


Home Library Learn Downloads Support Community Forums
Printer Friendly Version Content...

Add To Favorites

Send

Add

Click to Rate and Give Feedback

MSDN Library .NET Framework Class Library Clip Property

MSDN

MSDN Library

.NET Development Cursor Class

.NET Framework 3.5 Cursor Properties

System.Windows.Forms Namespace

Switch on low bandwidth view Language Collapse Collapse Language Filter All All/Expand Filter .NET Framework Class Library All

Cursor.Clip Property
Gets or sets the bounds that represent the clipping rectangle for the cursor. Namespace: System.Windows.Forms

This page is specific to Microsoft Visual Studio 2008/.NET Framework 3.5 Other versions are also available for the following: Microsoft Visual Studio 2003/.NET Framework 1.1

Assembly: System.Windows.Forms (in System.Windows.Forms.dll)

Syntax

Microsoft Visual Studio 2005/.NET Framework 2.0

.NET Framework 3.0 Microsoft Visual Studio 2010/.NET Framework 4.0

Visual Basic (Declaration)

Public Shared Property Clip As Rectangle

Visual Basic (Usage)

Dim value As Rectangle value = Cursor.Clip Cursor.Clip = value

file:///C|/Documents%20and%20Settings/Dear-U...Clip%20Property%20(System_Windows_Forms).htm (1 of 4) [2009/08/08 04:32:50 ].

Cursor.Clip Property (System.Windows.Forms)

C#

public static Rectangle Clip { get; set; }

Visual C++

public: static property Rectangle Clip { Rectangle get (); void set (Rectangle value); }

JScript

public static function get Clip () : Rectangle public static function set Clip (value : Rectangle)

Property Value Type: System.Drawing.Rectangle The Rectangle that represents the clipping rectangle for the Cursor, in screen coordinates.

Remarks
A clipped cursor is allowed to move only within its clipping rectangle. Generally, the system allows this only if the mouse is currently captured. If the cursor is not currently clipped, the resulting rectangle contains the dimensions of the entire screen.

Examples
The following code example creates a cursor from the Current cursor's Handle, changes its position and clipping rectangle. The result is the cursor will move up and to the left 50 pixels from where it is when the code is executed. Additionally, the cursor's clipping rectangle is changed to the bounds of the form (by default it is the user's whole screen). This example requires that you have a Form and a Button to call this code when it is clicked. Visual Basic Copy Code

Private Sub MoveCursor() ' Set the Current cursor, move the cursor's Position, ' and set its clipping rectangle to the form. Me.Cursor = New Cursor(Cursor.Current.Handle) Cursor.Position = New Point(Cursor.Position.X - 50, Cursor.Position.Y - 50) Cursor.Clip = New Rectangle(Me.Location, Me.Size) End Sub

C#

Copy Code

private void MoveCursor() {

file:///C|/Documents%20and%20Settings/Dear-U...Clip%20Property%20(System_Windows_Forms).htm (2 of 4) [2009/08/08 04:32:50 ].

Cursor.Clip Property (System.Windows.Forms)

// Set the Current cursor, move the cursor's Position, // and set its clipping rectangle to the form. this.Cursor = new Cursor(Cursor.Current.Handle); Cursor.Position = new Point(Cursor.Position.X - 50, Cursor.Position.Y - 50); Cursor.Clip = new Rectangle(this.Location, this.Size); }

Visual C++

Copy Code

void MoveCursor() { // Set the Current cursor, move the cursor's Position, // and set its clipping rectangle to the form. this->Cursor = gcnew System::Windows::Forms::Cursor( ::Cursor::Current->Handle ); ::Cursor::Position = Point(::Cursor::Position.X - 50,::Cursor::Position.Y - 50); ::Cursor::Clip = Rectangle(this->Location,this->Size); }

.NET Framework Security

UIPermission for all windows to set this property. Associated enumeration: UIPermissionWindow.AllWindows

Platforms
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98 The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information
.NET Framework Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

See Also
Reference Cursor Class Cursor Members System.Windows.Forms Namespace

: Add Tags What's a tag

this?

file:///C|/Documents%20and%20Settings/Dear-U...Clip%20Property%20(System_Windows_Forms).htm (3 of 4) [2009/08/08 04:32:50 ].

Cursor.Clip Property (System.Windows.Forms)

Community Content
Add new content

What is Community Content? |


Trademarks

Annotations RSS

2009 Microsoft Corporation. All rights reserved. Terms of Use

Privacy Statement

file:///C|/Documents%20and%20Settings/Dear-U...Clip%20Property%20(System_Windows_Forms).htm (4 of 4) [2009/08/08 04:32:50 ].

Você também pode gostar