Hi, I want to let user to place text on the map and be able to edit, change it. So to select text to edit user will hit it with mouse, but How do I know if mouse hit the text? I think mouse interacts only with shapes. I tried to make shape the same size like text, but when I zoom in/out the text size changes, but shapes size stays the same.
So maybe there is a better way to know if mouse hit text?
You can use point shapes instead, and make them invisible, so when you click on the map, you can make a boudingbox by the mouse coordinates and call GetFeaturesInsideBoundingBox to get the points and their text.
GdiPlusGeoCanvas a = new GdiPlusGeoCanvas(); float size = 10; GeoFont font = new GeoFont("Arial", size); float textWidth = a.MeasureText("12345", font).Width;
//shapes in your layer. RectangleShape rect = new RectangleShape(); double rectangleWidth = rect.Width / winformsMap1.CurrentExtent.Width * winformsMap1.Width; while (textWidth < rectangleWidth - 1) { size++; font = new GeoFont("Arial", size); textWidth = a.MeasureText("12345", font).Width; }