Customizing Mouse Cursors

New mouse devices are allocated the default mouse cursor. To distinguish each mouse cursor, you can assign custom cursors.

Assigning Custom Images

You can assign bitmap images to pointers using the Sdk.Samples.Common.CursorAssignments.AssignCursorToMouse method.

  1. Create pointer images to use in .jpg, .gif, or, .png format and add them as resources to the project. The SDK provides 53 sample cursors in the <Installation Path>\Samples\Common\Cursors folder.

  2. To access these resources as bitmap objects, import the System.Drawing namespace, as follows:

    using System.Drawing;

  3. Create a new lookup function called GetCursorImage, passing in the ID. This function returns an image, as follows:

    private Bitmap GetCursorImage(int id)
    {
        switch (id)
        {
            case 0:
                return Properties.Resources.boy_01;
            case 1:
                return Properties.Resources.boy_02;
            case 2:
                return Properties.Resources.boy_03;
            case 3:
                return Properties.Resources.boy_04;
            default:
                return Properties.Resources.boy_05;
        }
    }
    

For a complete example, see Microsoft.Multipoint.Sdk.Samples.Common.CursorAssignments.cs.