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,开发者_JS百科gif, tiff) files.
So where i can add *.cur files. How can i do it?
thanks
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);
}
If you click "Add Resources..." There is an option for "Add Existing File..." Choose it and select your file.
thanks Friends
I have done it.
I used following code for conversion:
Cursor My = new Cursor(new System.IO.MemoryStream(CursorTest.Resource1.MyCurFile));
精彩评论