FeatureLayer Mouse over cursor

2179
4
Jump to solution
06-04-2012 06:26 AM
bayramüçüncü
New Contributor III
Hi,
I have a featurelayers in mymap. How can I change my mouse cursor over the layer? Default cursor is Arrow. If I get over a layer, cursor should be Handle.
0 Kudos
1 Solution

Accepted Solutions
DominiqueBroux
Esri Frequent Contributor
As Joe suggested, you can change the cursor when hovering a feature by wiring up the MouseEnter and MouseLeave FeatureLayer events.
You can change the cursor with code like:
private void FeatureLayer_MouseEnter(object sender, GraphicMouseEventArgs e) {   MyMap.Cursor = Cursors.Hand; } private void FeatureLayer_MouseLeave(object sender, GraphicMouseEventArgs e) {   MyMap.Cursor = Cursors.Arrow; } 

View solution in original post

0 Kudos
4 Replies
JoeHershman
MVP Regular Contributor
Map has a Cursor property, FeatureLayer has MouseEnter, MouseLeave events.
Thanks,
-Joe
0 Kudos
bayramüçüncü
New Contributor III
Map has a Cursor property, FeatureLayer has MouseEnter, MouseLeave events.


Yes it has properties but not change mouse cursor. Some controls has cursor property, but featurelayer has not cursor property. So I cannot apply this.
0 Kudos
DominiqueBroux
Esri Frequent Contributor
As Joe suggested, you can change the cursor when hovering a feature by wiring up the MouseEnter and MouseLeave FeatureLayer events.
You can change the cursor with code like:
private void FeatureLayer_MouseEnter(object sender, GraphicMouseEventArgs e) {   MyMap.Cursor = Cursors.Hand; } private void FeatureLayer_MouseLeave(object sender, GraphicMouseEventArgs e) {   MyMap.Cursor = Cursors.Arrow; } 
0 Kudos
JoeHershman
MVP Regular Contributor
On you map add a MouseMove event handler.

private void MapMouseMove(object sender, MouseEventArgs mouseEventArgs)
{
    MapPoint mapPoint = MyMap.ScreenToMap(mouseEventArgs.GetPosition(MyMap));
    MyMap.Cursor = MyFeatureLayer.FullExtent.Intersects(mapPoint) ? Cursors.Hand : Cursors.Arrow;
}


Will change the Cursor anytime it is inside the extent of the FeatureLayer
Thanks,
-Joe
0 Kudos