Cursor.Clip Egenskap

Definition

Hämtar eller anger de gränser som representerar urklippsrektangeln för markören.

public:
 static property System::Drawing::Rectangle Clip { System::Drawing::Rectangle get(); void set(System::Drawing::Rectangle value); };
public static System.Drawing.Rectangle Clip { get; set; }
static member Clip : System.Drawing.Rectangle with get, set
Public Shared Property Clip As Rectangle

Egenskapsvärde

Det Rectangle som representerar urklippsrektangeln för Cursorskärmkoordinaterna i i .

Exempel

I följande kodexempel skapas en markör från Current markörens Handle, ändrar dess position och urklippsrektangeln. Resultatet är att markören flyttas upp och till vänster 50 bildpunkter från där den körs. Dessutom ändras markörens urklippsrektangeln till formulärets gränser (som standard är det användarens hela skärm). Det här exemplet kräver att du har en Form och en Button för att anropa den här koden när den klickas.

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);

}
private void MoveCursor()
{
   // 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);
}
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

Kommentarer

En klippt markör kan endast flyttas inom urklippsrektangeln. I allmänhet tillåter systemet endast detta om musen för närvarande fångas. Om markören för närvarande inte är klippt innehåller den resulterande rektangeln dimensionerna för hela skärmen.

Gäller för