Embed a Custom Cursor?

B

bern11

How do you embed a custom cursor? The help says:

// On the command line:
// Add the following flag:
// /res:CursorFileName.Cur,Namespace.CursorFileName.Cur

What if you are compiling with the IDE? I don't see a 'command line
options' field anywhere...???
 
V

VJ

IDE you will include the file in the project and there is a property
available in the property window called "Build Action", when you select the
file. Set that to "Embedded Resource"

VJ
 
B

bern11

I have the build options to 'Embedded Resource', it still does not
work. Every time it reaches the cursor statement, I get a "Object
reference not set to an instance of an object." error. This is my
statement:

Cursor myCurdor;
myCursor = new Cursor(GetType(), "Cursor1.cur");

"Cursor1.cur" is a cursor file added to the project with "Embedded
Resource" selected. I've tried screwing aorund with 'custom tool
namespace', but it doesn't seem to matter.
 
V

VJ

Ahh ok that is the second part it has to be fully qualified name, like
something below should get you started. AboutImage.gif is a embbed resource
for us.

System.IO.Stream picBkg2 =
System.Reflection.Assembly.GetAssembly(typeof(namespace1.namespace2.class1)).GetManifestResourceStream("namespace1.class1.AboutImage.GIF");
picturebox1.Image = Image.FromStream(picBkg2);


VJ

Namspace.
 
B

bern11

OK - figured it out. I didn't notice but when I created it, it went
into the 'Properties' folder and hence the 'Properties' subdirectory. I
moved it in the solution manager to off the main project and it works.
Thanks for the help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top