GOA - System.Windows.Forms.Cursor

Cursor Class


Represents the image used to paint the mouse pointer.

Definition

public class Cursor: Object, IDisposable

Members Table

MethodDescription
CursorOverloaded. Initializes a new instance of Cursor.
DisposeReleases all resources used by the Cursor.
EqualsOverloaded. Compares two objects to determine if they are equal.
GetHashCodeOverriden. Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetTypeGets the Type of the current instance. (Inherited from Object)
HideHides the Cursor.
ReferenceEqualsDetermines whether the specified Object instances are the same instance. (Inherited from Object)
ShowDisplays the Cursor.
ToStringReturns a String that represents the current Object. (Inherited from Object)
PropertyDescription
CurrentGets a cursor object that represents the mouse cursor.
HandleGets the handle of the cursor.
HotSpotGets the position of the hotspot of the cursor.
PositionGets the position of the Cursor.
TagGets or sets the object that contains data about the cursor.
OperatorDescription
operator !=Determines whether two specified Cursor objects are different.
operator ==Determines whether two specified Cursor objects are equivalent.

Inheritance Hierarchy

Object
Cursor

Examples

// This sample show how to create a new Cursor, it also displays some properties of the cursor.

 

using System;

using System.Drawing;

using System.Windows.Forms;

using System.Diagnostics;

 

public class Form1 : System.Windows.Forms.Form

{

     private System.Windows.Forms.Button button;

 

     static void Main()

     {

          Application.Run(new Form1());

     }

 

     public Form1()

     {

          this.button = new System.Windows.Forms.Button();

          this.button.Location = new System.Drawing.Point(8,8);

          this.button.Size = new System.Drawing.Size(100,50);

          this.button.Text = "Button";

 

          // Creates a new cursor for the button.

          Cursor my_cursor = Cursors.No;

          this.button.Cursor= my_cursor;

 

          // Displays some properties of the cursor.

          Debug.WriteLine("Properties of the cursor:");

          Debug.WriteLine("\tHotspot:" +my_cursor.HotSpot);

          Debug.WriteLine("\tHandle:" +my_cursor.Handle);

          Debug.WriteLine("\tTag:" +my_cursor.Tag);

 

          this.Controls.Add(this.button);

     }

 

     // The cursor which will be used on the form.

     protected override void OnMouseEnter(EventArgs e)

     {

          Debug.WriteLine("Enter the form");

          this.Cursor = Cursors.Hand;

          Debug.WriteLine("Position:" +Cursor.Position);

     }

 

     protected override void OnMouseLeave(EventArgs e)

     {

          Debug.WriteLine("Leave the form");

          this.Cursor = Cursors.Default;

     }

}

Class Information

NamespaceSystem.Windows.Forms
Flash LibrarySystem.Windows.Forms.scl
Flash Library Version2.0.0.2118
Silverlight LibrarySystem.Windows.Forms.dll



© 2003-2007 NETiKA Technologies. All rights reserved.