New to Telerik UI for WinFormsStart a free 30-day trial

Provides utility methods for creating and managing custom cursors with DPI scaling support.

Definition

Namespace:Telerik.WinControls

Assembly:Telerik.WinControls.dll

Syntax:

C#
public static class CursorHelper

Inheritance: objectCursorHelper

Properties

Gets a flipped arrow cursor optimized for 96 DPI (standard resolution).

C#
public static Cursor FlippedArrowCursor { get; }
Property Value:

A Cursor representing a flipped arrow cursor at standard 96 DPI resolution.

Remarks:

This property provides quick access to a flipped arrow cursor designed for standard DPI settings. The cursor is ideal for indicating reverse or opposite directional operations in the user interface.

For high-DPI scenarios, use GetScaledFlippedArrowCursor(SizeF) instead to ensure proper scaling.

Methods

Creates a custom cursor from a bitmap image with the specified hot spot.

C#
public static Cursor CursorFromBitmap(Bitmap bitmap, Point hotSpot)
Parameters:bitmapBitmap

The bitmap image to use as the cursor appearance.

hotSpotPoint

The point within the bitmap that represents the cursor's active point.

Returns:

Cursor

A new Cursor instance created from the bitmap with the specified hot spot.

Remarks:

This method converts a bitmap image into a Windows cursor by:

  1. Converting the bitmap to an icon handle using GetHicon
  2. Retrieving and modifying the icon information
  3. Setting the custom hot spot coordinates
  4. Creating the final cursor using CreateIconIndirect

The hot spot determines which pixel of the cursor image corresponds to the precise mouse position. For example, an arrow cursor typically has its hot spot at the tip of the arrow.

The caller is responsible for disposing of the returned cursor when it's no longer needed.

Gets a flipped arrow cursor scaled to the specified DPI scaling factor.

C#
public static Cursor GetScaledFlippedArrowCursor(SizeF scaling)
Parameters:scalingSizeF

The scaling factor to apply to the cursor (e.g., 1.5 for 150% DPI scaling).

Returns:

Cursor

A Cursor representing a flipped arrow cursor scaled for the specified DPI.

Remarks:

This method provides DPI-aware flipped arrow cursors by:

  1. Loading the cursor from an embedded SVG resource for scalable rendering
  2. Caching cursors for each unique scaling factor to improve performance
  3. Calculating the appropriate size and hot spot based on the scaling factor
  4. Generating a bitmap at the target resolution for crisp appearance

The cursor uses SVG-based rendering to ensure sharp, clean appearance at any DPI setting. The hot spot is automatically scaled to maintain proper cursor behavior across different resolutions.

Cursors are cached per scaling factor, so subsequent calls with the same scaling value return the cached cursor for optimal performance.