Shaifali Goel
Shaifali Goel

Reputation: 19

Custom caret in datagridview

I am working on c# datagridview project where I have to change the default caret to dos like caret. I have search the internet buy unable to find any solution . Any suggestions from the respective members.

Upvotes: 0

Views: 82

Answers (1)

FrozenAssassine
FrozenAssassine

Reputation: 1450

To change the cursor using the Designer:

1: Go to the designer and right-click your control.

2: In the right-click-menu go to Properties

3: In properties scroll down to Cursor and select the cursor you want.

Or to change the cursor to a custom cursor:

The function to change the cursor:

public static Cursor ActuallyLoadCursor(String path)
{
    return new Cursor(LoadCursorFromFile(path));
}
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern IntPtr LoadCursorFromFile(string fileName);

code from: Custom cursor in C# Winforms

Call the function:

yourdatagrid.Cursor = ActuallyLoadCursor("PathToYourCursor.cur");

Also take a look at this folder to find a cursor: C:\Windows\Cursors

Upvotes: 1

Related Questions