Device.SetCursorProperties(Int32,Int32,Surface) Method (Microsoft.DirectX.Direct3D)

Sets properties for the cursor.

Definition

Visual BasicPublic Sub SetCursorProperties( _
    ByVal hotSpotX As Integer, _
    ByVal hotSpotY As Integer, _
    ByVal cursorBitmap As Surface _
)
C#public void SetCursorProperties(
    int hotSpotX,
    int hotSpotY,
    Surface cursorBitmap
);
C++public:
void SetCursorProperties(
    int hotSpotX,
    int hotSpotY,
    SurfacecursorBitmap
);
JScriptpublic function SetCursorProperties(
    hotSpotX : int,
    hotSpotY : int,
    cursorBitmap : Surface
);

Parameters

hotSpotX System.Int32
X-coordinate offset (in pixels) that marks the center of the cursor. The offset is relative to the upper-left corner of the cursor. When the cursor is given a new position, the image is drawn at an offset from the new position. The offset is determined by subtracting the hot spot coordinates from the position.
hotSpotY System.Int32
Y-coordinate offset (in pixels) that marks the center of the cursor. The offset is relative to the upper-left corner of the cursor. When the cursor is given a new position, the image is drawn at an offset from the new position. The offset is determined by subtracting the hot spot coordinates from the position.
cursorBitmap Microsoft.DirectX.Direct3D.Surface
A Surface object. This parameter must be an 8888 ARGB surface (format A8R8G8B8). The contents of this surface are copied and potentially converted into an internal buffer from which the cursor is displayed. The dimensions of this surface must be less than the dimensions of the display mode, and must be a power of two in each direction, although not necessarily the same power of two. The alpha channel must be either 0.0 or 1.0.

Remarks

An operating system cursor is created and used under either of the following conditions.

  • The hardware set CursorCaps.SupportsColor to true and the cursor size is 32x32 (which is the cursor size in the operating system).
  • The application is running in windowed mode.

If neither condition is present, Microsoft DirectX uses an emulated cursor. An application uses Device.SetCursorPosition to move an emulated cursor in order to follow mouse movement.

To determine which hardware support is available for cursors, an application can examine appropriate members of the Caps structure. Typically, hardware supports only 32x32 cursors, and the system, when windowed, also might support only 32x32 cursors. In this case, Device.SetCursorProperties still succeeds, but the cursor might be reduced to that size. The hot spot is scaled appropriately.

The cursor does not survive when the device is lost. This method must be called after the device is reset.

Exceptions
InvalidCallException The method call is invalid. For example, a method's parameter might contain an invalid value.

See Also

Show: