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
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.
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.
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 love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With