I display in a winform the ultraGeographicMap , I would like to know if I can simulate the event MouseWheel by another event MouseClick for example to zoom In/Out.
Thank you in advance for your assistance
Hello Mike,
Thank you very much for your answer, that's exactly what I wanted to do. I tested your code it works very well
Hi Haris,
Yes, you can do this. You can zoom the mouse in or out in response to a mouse click with the following logic
// when handling mouse click: // get a point representing location where mouse was clicked // check if left or right mouse button was clicked // call ZoomMapIn(mouseLocation) for left mouse click // or // call ZoomMapOut(mouseLocation) for right mouse click void ZoomMapIn(Point center) { // might need to adjust delta if zooming in is too fast ZoomMap(Point center, 0.05) } void ZoomMapOut(Point center) { // might need to adjust delta if zooming out is too fast ZoomMap(Point center, -0.05) } void ZoomMap(Point center, double delta) { double scale = 1.0 - MathUtil.Clamp(delta, -0.5, 0.5); double left = center.X - scale * (center.X - this.GeoMap.WindowRect.Left); double bottom = center.Y + scale * (this.GeoMap.WindowRect.Bottom - center.Y); double right = center.X + scale * (this.GeoMap.WindowRect.Right - center.X); double top = center.Y - scale * (center.Y - this.GeoMap.WindowRect.Top); Rect window = new Rect(left, top, right - left, bottom - top); this.GeoMap.WindowRect = window; }
Please try this out and let me know whether it works for you.