In my VB.net project I created a custom cursor (Window.cur). How can I assign that to the cursor without having to use the full file path to that file?
VB.Net has My.Resources but it does not show the cursors that are embedded in the project.
I found an example that used code like this:
New Cursor(Reflection.Assembly.GetExecutingAssembly.GetManifestResourceStream("Window.cur")
but that does not work.
Guessing the resource name can be difficult. To find out, run Ildasm.exe on your program. Double-click "Manifest" and look for the .mresource.
Another way to do it that avoids guessing: Project + Properties, Resource tab. Click the arrow on the "Add Resource" button, Add Existing File and select your .cur file. Make your code look like this:
Dim ms As New System.IO.MemoryStream(My.Resources.Cursor1)
Button1.Cursor = New Cursor(ms)