This project has moved. For the latest updates, please go here.

Exception through MapImage when click in Tool Mode

Topics: SharpMap v0.9 / v1.x, WinForms Controls
Jan 17, 2009 at 7:44 PM

Hello everybody,

I know that this is a stupid question but I'm new to Sharpmap and hope to get help from you for following problem:

On a form, there are 3 radio button (Zoom In, Zoom Out, Pan). Clicking on radion button will set MapImage.ActiveTool to a tool of Zoom In, Zoom Out or Pan. And I have no code for my MapImage in event of Click, MouseDown, MouseUp... because I think just set the ActiveTool, sharpmap will do everything when I click on the MapImage

But when I click on MapImage, it will be blank (no map image). if I click or do something by mouse, the exception will accur because there is no image on the MapImage

How can I fix this ?

Thanks for your attention
Jan 18, 2009 at 11:25 AM
can you post the exception/ stack trace or better still the problem code cheers jd
Jan 20, 2009 at 4:51 AM
Your MapImage may become blank because of null Map (MapImage.Map). If so, you have to set the Map proerties for MapImage in routine of initiation the Map

Then the exception will accur because there is no Image for MapImage, it mean no thing to pan or zoom

I have met this when I got started with ShapeMap.

Hope this helps !