Take the 2-minute tour ×

My application makes use of a custom cursor loaded from a predefined file (.cur) during runtime. I know windows uses a standard 32x32 pixels cursor or a 48x48 pixel cursor for high DPI devices.

The cursor I want to use in my application however is much larger. A small cursor is displayed correctly when I use Mouse.SetCursor(_CustomCursor). When a larger cursor is chosen, I don't see any cursor. It would seem that the cursor loads correctly but cannot be displayed.

Note: Currently a static .cur cursor is acceptable.

Is there a way to display larger cursors in my application and if there is a limit on the size, what is it?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Is there a restriction to cursor sizes?

Yes, it's a system restriction. Not just for VB.NET...

To get the max size of the Cursor you can use, you should query the SystemParameters.CursorHeight and SystemParameters.CursorWidth properties.

As stated by MSDN these properties are mapped to the SM_CYCURSOR andSM_CXCURSOR properties respectivly. As you can read in MSDN

SM_CXCURSOR 13 The width of a cursor, in pixels. The system cannot create cursors of other sizes.


SM_CYCURSOR 14 The height of a cursor, in pixels. The system cannot create cursors of other sizes.

share|improve this answer
How do games etc. create their own custom cursor? –  Christian Sauer Jan 4 '13 at 15:02
They dont use vb, for starters –  Blachshma Jan 4 '13 at 16:29
@ChristianSauer The method in my new answer might remove some of the size restrictions on cursors and allows for any custom cursor to be displayed, perhaps game developers follow a similar approach. –  blaffie Jan 7 '13 at 8:36

So I managed to find a work around to the problem on the size restriction.

As mentioned on Cursor from BitMap one can create a cursor of arbitrary size from a bitmap.

The code to achieve this is as follows:

Dim bm As New Bitmap(60, 60)                 'Or from a bitmap file
Dim g As Graphics = Graphics.FromImage(bm)   
g.FillRectangle(Brushes.Blue, 0, 0, 60, 60)  'For a simple blue rectangle cursor
Dim ptrCur As IntPtr = bm.GetHicon
Dim CustomCursor As Cursor
CustomCursor = New Cursor(ptrCur)
Me.Cursor = CustomCursor                     'Set the application cursor to be custom

The hotspot is automatically set to the centre of the bitmap. Here is a preview of the results:

Large Blue Cursor

This code works well on a Windows forms application. With a WPF application an 'invalid extension for cursor' exception is thrown. Will be looking into resolving it (any suggestions welcome).

EDIT: In WPF a restriction of 96 pixels is applied to any dimension of the cursor, anything bigger will not display.

share|improve this answer
As you mentioned, this will work only for a winforms implementation, not WPF... Also the main problem with this solution is not being able to choose where the hotspot is located... –  Blachshma Jan 7 '13 at 9:31

Your Answer


