Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Add cursor files in resources of control Library project

Tags:

c#

.net

I am creating a Control Library project. I have some Cursor files which i want to add on resources.

Because on Resources.resx--->Add resources is only for String, Icon (.ico), Text file(.txt), Image (Png,bmp,jpeg,gif, tiff) files.

So where i can add *.cur files. How can i do it?

thanks

like image 510
prashant Avatar asked Mar 12 '10 12:03

prashant


People also ask

How do I open a CUR file in Visual Studio?

All you need is something to create a cursor file with. You can do that in Visual Studio using the built-in Image Editor for Icons, see: [ 1 ] [ 2 ]. You can just open the Add New Item dialog and select a cursor file from there. Then double-click it in the Solution Explorer to edit it.


1 Answers

There is also a category Other. There you can add anything you like.

Also you can click on the little down arrow next to Add Resource and click on Add Existing File .... It will put it automatically in the correct category.

Update

Ok. So the problem is not adding the file to the resources. Instead loading it from there makes the problem, cause the Cursor class only supports a Stream, but not a byte[].

In that case you should put it into a MemoryStream and give this to the Cursor constructor.

Cursor myCursor;
using (var memoryStream = new MemoryStream(Properties.Resources.MyCursorFile))
{
    myCursor = new Cursor(memoryStream);
}
like image 53
Oliver Avatar answered Nov 03 '22 23:11

Oliver