共用方式為


Cursor.Clip 屬性

定義

取得或設定表示游標裁剪方框的範圍。

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; }
member this.Clip : System.Drawing.Rectangle with get, set
Public Shared Property Clip As Rectangle

屬性值

Rectangle

Rectangle,代表在螢幕座標中 Cursor 的裁剪方框。

範例

下列程式碼範例會從 Current 游標的 Handle 建立資料指標,並變更其位置和裁剪矩形。 結果是游標會向上移動,並在執行程式碼時,向左移動 50 圖元。 此外,游標的裁剪矩形預設會變更為表單界限, (預設為使用者的整個螢幕) 。 此範例會要求您在按一下此程式碼時,必須有 FormButton 來呼叫。

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

備註

裁剪的游標只能在其裁剪矩形內移動。 一般而言,只有在目前擷取滑鼠時,系統才會允許此專案。 如果目前未裁剪游標,產生的矩形會包含整個螢幕的維度。

適用於