Cursor.Clip Proprietà
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Ottiene o imposta i limiti che rappresentano il rettangolo di ritaglio per il cursore.
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
Valore della proprietà
Oggetto Rectangle che rappresenta il rettangolo di ritaglio per , Cursornelle coordinate dello schermo.
Esempio
Nell'esempio Currentdi codice seguente viene creato un cursore dal Handle cursore , viene modificata la posizione e il rettangolo di ritaglio. Il risultato è che il cursore verrà spostato verso l'alto e verso sinistra 50 pixel da dove si trova quando viene eseguito il codice. Inoltre, il rettangolo di ritaglio del cursore viene modificato nei limiti del form (per impostazione predefinita è l'intero schermo dell'utente). In questo esempio è necessario disporre di un Form e un oggetto Button per chiamare questo codice quando viene fatto clic su di esso.
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
Commenti
Un cursore ritagliato può essere spostato solo all'interno del rettangolo di ritaglio. In genere, il sistema consente questo solo se il mouse è attualmente acquisito. Se il cursore non è attualmente ritagliato, il rettangolo risultante contiene le dimensioni dell'intero schermo.