共用方式為


Cursor.Equals(Object) 方法

定義

傳回值,指出這個游標是否等於指定的 Cursor

public:
 override bool Equals(System::Object ^ obj);
public override bool Equals (object obj);
public override bool Equals (object? obj);
override this.Equals : obj -> bool
Public Overrides Function Equals (obj As Object) As Boolean

參數

obj
Object

要比較的 Cursor

傳回

Boolean

如果這個游標和指定的 Cursor 相等,則為 true,否則為 false

範例

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

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

適用於