Hi Ben,
Back again, not quite there yet.
I'm very confused as to exactly what PositionInScreenCoordinates is and how it relates to the width and height of the winforms map control and the absolute position in pixels. The PositionInScreenCoordinates also seems to change with the zoom factor even if the point remains in the same physical poition on the winforms control.
I have the map control on a form, its width is 668 pixels and its height is 400 pixels, one single point with a label.
If I pan the map and position the point at the extreme top left hand edge of the map control its PositionInScreenCoordinates is reported as X = 165, Y = 247, move it to the right hand top corner and we get X = 933 and Y = 165, move it to the bottom right hand corner and we get X = 933 and Y = 503. This would seem to indicate that the width is 768 pixels and the height is 256 pixels. I'm confused. I kind of thought that the position in screen coordinates would be for the top left hand corner X = 0 and Y = 0 and for the left hand top corner x = 668 and Y = 0 etc.
What I am trying to do is to make sure that the labels that are positioned PointPlacement.UpperRight are always visible, so if the point is located on the left hand edge of the screen and is visible the label is displayed to the right of the point and is thus always fully visible.
My logic here would be to get the length of the label as drawn in pixels subtract that from PositionInScreenCoordinates.X and if the value is negative i.e off the visible screen, move the printed position of the label by adding the label width to PositionInScreenCoordinates.X to shift the label to the right of the point.
It seems daft to have a point visible on the screen with the label positioned to the right and not or only partially visible.
Any thoughts?
John