We find the standard tool mouse pointer, the crosshair, is hard to see for some of our users, we would like to be able to customize this mouse pointer when our custom tool is selected. Is this possible?
Hi Evan,
You can set the "Cursor" property of your custom tool to change the standard cursor.
<SPAN class="keyword token">internal</SPAN> <SPAN class="keyword token">class</SPAN> <SPAN class="token class-name">CustomMapTool</SPAN> <SPAN class="punctuation token">:</SPAN> MapTool <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">public</SPAN> <SPAN class="token function">CustomMapTool</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> IsSketchTool <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">true</SPAN><SPAN class="punctuation token">;</SPAN> SketchType <SPAN class="operator token">=</SPAN> SketchGeometryType<SPAN class="punctuation token">.</SPAN>Rectangle<SPAN class="punctuation token">;</SPAN> SketchOutputMode <SPAN class="operator token">=</SPAN> SketchOutputMode<SPAN class="punctuation token">.</SPAN>Map<SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">//A custom cursor file as an embedded resource</SPAN> <SPAN class="keyword token">var</SPAN> cursorEmbeddedResource <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Cursor</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">MemoryStream</SPAN><SPAN class="punctuation token">(</SPAN>MapExploration<SPAN class="punctuation token">.</SPAN>Resource1<SPAN class="punctuation token">.</SPAN>red_cursor<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">//A built in system cursor</SPAN> <SPAN class="keyword token">var</SPAN> systemCursor <SPAN class="operator token">=</SPAN> System<SPAN class="punctuation token">.</SPAN>Windows<SPAN class="punctuation token">.</SPAN>Input<SPAN class="punctuation token">.</SPAN>Cursors<SPAN class="punctuation token">.</SPAN>ArrowCD<SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">//Set the "CustomMapTool's" Cursor property to either one of the cursors defined above</SPAN> Cursor <SPAN class="operator token">=</SPAN> cursorEmbeddedResource<SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">//or</SPAN> Cursor <SPAN class="operator token">=</SPAN> systemCursor<SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Is there a way to do this type of customization with built in tools? I would like to be able to change the cross hair cursor that appears when using linked views to, like the original poster, better see the cursor.
Perfect, just what i was looking for. Thanks alot Uma.
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.