Windows Desktop
Introduction
Windows Desktop games can display custom cursors. The default XNA window is a Windows Forms window, so customization of the cursor visuals is done the same as for any other Windows Forms app.
Example Code - Changing the Cursor using MonoGame
MonoGame 3.6 and newer introduces a method for changing the Windows cursor. The cursor can be set from a Texture2D. Assuming CursorTexture is a valid Texture2D:
For more information, see the following links:
Example Code - Changing the Cursor using Windows Forms and .cur File
The following code loads a .cur file and sets the window's default cursor:
Example Code - Changing the Cursor using Windows Forms and .png File
.cur files have a 32x32 pixel size limit. This can be bypassed by loading a .png into a Bitmap object, then using that object to construct a Cursor, as shown in the following code:
Last updated