Cursor Resource

rbulph

Well-known member
Joined
Feb 17, 2003
Messages
343
If you add a cursor as a resource, how can you then use it? Im having some trouble - I just get the message that an array of bytes cannot be converted to a cursor.
 
You are compiling the cursor as an embedded resource, right?
[Vb]
VB
Dim X As New Cursor(Me.GetType, "Rootnamespace.Filename.withextension")

// C#
// subfolders is the folder relative to the project path, and should be
// omitted if the cursor is in the root project path
Cursor(X = New Cursor(this.GetType(),
"Rootnamespace.subfolders.Filename.withextension"))
[/code]
 
Thanks, but doesnt seem to work. I just get an Object is Nothing error. I take it "rootnamespace" in your code should be the name given to my project under that heading in the Application tab of the project?
 
The root namespace will be the name of the project unless you have explicitly changed it. Make sure that the "Compile Action" property of the icon file is set to "Embedded Resource".
 
marble_eater said:
The root namespace will be the name of the project unless you have explicitly changed it. Make sure that the "Compile Action" property of the icon file is set to "Embedded Resource".
Can see no such property.
 
Aha! Got it at last! If you select the cursor in the Resources tab, as I had done before, you get an entirely different set of properties than if you select it through the "Solution Explorer". Dont know why. But anyway, selecting it through the Solution Explorer does give the Build Action property. If I set that, and then you use your code, but omitting the Rootnamespace qualifier, it works! Thanks.
 
Back
Top