Select to view content in your preferred language

Change cursor for the graphics loaded in an KML layer

887
2
Jump to solution
06-18-2012 02:36 PM
TylerRothermund
Emerging Contributor
How can I set the cursor for the graphics loaded in a KML layer?
0 Kudos
1 Solution

Accepted Solutions
JenniferNery
Esri Regular Contributor
I think you can use the following code:
  private void KmlLayer_Initialized(object sender, EventArgs e)   {    var l = sender as KmlLayer;    if (l.Graphics != null)    {     foreach (var g in l.Graphics)     {      if (g is Graphic)      {       (g as Graphic).MouseEnter += Graphic_MouseEnter;       (g as Graphic).MouseLeave += Graphic_MouseLeave;      }     }    }   }    void Graphic_MouseLeave(object sender, MouseEventArgs e)   {    this.Cursor = Cursors.Arrow;   }    void Graphic_MouseEnter(object sender, MouseEventArgs e)   {    this.Cursor = Cursors.Hand;   }

View solution in original post

0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor
I think you can use the following code:
  private void KmlLayer_Initialized(object sender, EventArgs e)   {    var l = sender as KmlLayer;    if (l.Graphics != null)    {     foreach (var g in l.Graphics)     {      if (g is Graphic)      {       (g as Graphic).MouseEnter += Graphic_MouseEnter;       (g as Graphic).MouseLeave += Graphic_MouseLeave;      }     }    }   }    void Graphic_MouseLeave(object sender, MouseEventArgs e)   {    this.Cursor = Cursors.Arrow;   }    void Graphic_MouseEnter(object sender, MouseEventArgs e)   {    this.Cursor = Cursors.Hand;   }
0 Kudos
TylerRothermund
Emerging Contributor
Thanks Jennifer
0 Kudos