Cursor.Clip プロパティ
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
カーソルのクリッピング四角形を表す境界を取得または設定します。
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
Cursor のクリッピング四角形を画面座標で表す Rectangle。
次のコード例では、カーソルの からカーソルを作成し Current 、 Handleその位置とクリッピング四角形を変更します。 結果として、カーソルは上方向に移動し、コードの実行時の位置から左の 50 ピクセルに移動します。 さらに、カーソルのクリッピング四角形がフォームの境界に変更されます (既定では、ユーザーの画面全体です)。 この例では、 と Button を使用Formして、このコードをクリックしたときにこのコードを呼び出す必要があります。
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
クリップされたカーソルは、クリッピング四角形内でのみ移動できます。 一般に、システムでは、マウスが現在キャプチャされている場合にのみこれを許可します。 カーソルが現在クリップされていない場合、結果の四角形には画面全体の寸法が含まれます。
製品 | バージョン |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
.NET に関するフィードバック
.NET はオープンソース プロジェクトです。 フィードバックを提供するにはリンクを選択します。