worlanyo wrote:
https://dotspatial.codeplex.com/discussions/395453
And please share the result if you can make it work..I think the grid line is a need and will be great if we can prepare it for dotspatial.
I have written a code to generate a gridline on the map1 but I am not able to convert the coordinate values to the map coordinate. Please can someone help me get this working.I use this code to get coordinates of mouse..
I know its something like this "map1.PixelToProj(pixel X, pixel.Y, ref projected x, ref projected y);" but it does not seem to work for me at all
My code is belowSystem.Drawing.Graphics g = map1.CreateGraphics(); Bitmap img = new Bitmap(100, 100); //System.Drawing.Graphics g = Graphics.FromImage(img); Pen drawingPen = new Pen(Color.Black, 1); int GridScrollOffset = 5; int GridSpacingX = 100; // Draw all visible, vertical gridlines for (int i = this.map1.Width - GridScrollOffset; i >= 0; i -= GridSpacingX) { g.DrawLine(drawingPen, i, 0, i, this.map1.Height); } int GridSpacingY=200; //Draw all horizontal lines. //Pen p = new Pen(Color.FromName(YGridColor.Name)); // Draw all visible, horizontal gridlines for (int j = this.map1.Height; j >= 0; j -= GridSpacingY) { g.DrawLine(drawingPen, 0, j, this.map1.Width, j); }
DotSpatial.Topology.Coordinate ClickCoordinate = new DotSpatial.Topology.Coordinate();
ClickCoordinate = map1.PixelToProj(e.Location);
this could help you..Also take a look at this topic https://dotspatial.codeplex.com/discussions/395453
And please share the result if you can make it work..I think the grid line is a need and will be great if we can prepare it for dotspatial.