I want to change the cursor pointer when user selects a tool, I got the sample but I don't know what MapExploration.Resource1.red_cursor is ? I don't know if it is a file, file path or even an object. I appreciate if anyone gives me an explanation or a full example without shortcuts.
Here is the code in the sample:
internal class CustomMapTool : MapTool { public CustomMapTool() { IsSketchTool = true; SketchType = SketchGeometryType.Rectangle; SketchOutputMode = SketchOutputMode.Map; //A custom cursor file as an embedded resource var cursorEmbeddedResource = new Cursor(new MemoryStream(MapExploration.Resource1.red_cursor)); //A built in system cursor var systemCursor = System.Windows.Input.Cursors.ArrowCD; //Set the "CustomMapTool's" Cursor property to either one of the cursors defined above Cursor = cursorEmbeddedResource; //or Cursor = systemCursor; }
And here is the link of the sample Change the cursor of a tool.
Solved! Go to Solution.
Hi,
You need to add your cursor file to visual studio project as resource. Instead of
"MapExploration.Resource1.red_cursor"
use
Properties.Resources.<your_cursor_resource-name>
Hi,
You need to add your cursor file to visual studio project as resource. Instead of
"MapExploration.Resource1.red_cursor"
use
Properties.Resources.<your_cursor_resource-name>
I had to add the file -as you said- as resource. This Link also helped to add the file in the wright way.