radioman / greatmaps

GMap.NET - Great Maps for Windows Forms & Presentation
909 stars 409 forks source link

DrawToBitmap #149

Open Elwood472 opened 4 years ago

Elwood472 commented 4 years ago

I feel like there is something wrong with the DrawToBitmap feature. This code works perfect to create a 140x100 image of the top left corner. However, I am not able to get an accurate image from anywhere else

Dim ThisMap As New Bitmap(140, 100)
Form2.myMap.DrawToBitmap(ThisMap, New Rectangle(0, 0, Form2.myMap.Width, Form2.myMap.Height))

If I wanted to grab 140x100 starting horizontally at 10, I feel I would write this:

Dim ThisMap As New Bitmap(140, 100)
Form2.myMap.DrawToBitmap(ThisMap, New Rectangle(**10**, 0, _
    Form2.myMap.Width, Form2.myMap.Height))

But instead of getting x10 to x150 and y0 to y100, I get x-10 to x130 and y0 to y100. The first 10 pixels on the left are empty.

If this isn't a flaw, I'd appreciate learning to get the correct location for an image.