Share via


How to: Add Cursor Support

The Visual Studio SDK provides user interface (UI) element cursor support so developers can create consistent user interfaces that support Windows themes and multiple color schemes. Developers can query the Visual Studio integrated development environment (IDE) for the correct type of cursor to use with a specific element of the IDE.

The SVsUIShell service implements cursor support for UI elements through the IVsUIShell2 interface.

To use the cursor service

  1. Obtain an instance of the IVsUIShell2 interface.

    For COM-based VSPackages, call the QueryService method with a service ID of SID_SVsUIShell and an interface ID of IID_IVsUIShell2.

    For managed code-based VSPackages, call GetService with an argument of (typeof(SVsUIShell)) and cast to the IVsUIShell2 interface.

  2. Choose a value from the __VSCURSORTYPE enumeration to specify the type of cursor to be used.

    For more information, see User Interface Design Guidelines.

  3. Use the selected member of the __VSCURSORTYPE enumeration as an argument of the GetVSCursor method of the IVsUIShell2 interface to obtain a 32-bit integer (HCURSOR) as a handle to the appropriate cursor.

    VSPackages written with unmanaged code or C++ can directly use the cursor by using the standard Windows cursor management tools. For more information, see Cursors.

    VSPackages created with managed code should instantiate an instance of the Cursor class by using the overload of its constructor that takes a handle to a cursor as an argument.

See Also

Reference

IVsUIShell2

GetVSCursor

QueryService

GetService