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

Display map in Panel

Topics: General Topics
Mar 6, 2007 at 12:21 PM
Hi everyone,

I'm working on a Pocket PC 2003 project which consist of one main form and some panels. Is there any way to display the Map at one of the panels rather than on the main form, where it is situated by default?

Then I've got another problem. It's probably very simple but I can't seem to wrap my head around it. When the map is displayed on the main form, it shows only one small part of it in the lower right corner of the form. Does anybody has an idea, why it could be offset like that? I didn't do anything to displace it, at least not that I can think of at the moment.

Aside of that I tested exactly the same SharpMap Code in another (new) Smart Device project without any problems. Just in case here is the code snippet:

myArcLayer.DataSource = New SharpMap.Data.Providers.ShapeFile(STRSHAPEPATH)
myArcLayer.Style.Line.Width = 2
myArcLayer.Style.Line.Color = Color.Red
myArcLayer.Style.Fill = New SolidBrush(Color.LightGreen)
myArcLayer.Style.EnableOutline = True

'that didn't seem to do anything, nothing happened when I changed the values
'myVectorMap.Center = New SharpMap.Geometries.Point(120, 160) 'Set center of map


Any help would be really appreciated.

Mar 6, 2007 at 5:06 PM
For your first issue, I'm not sure about PPC. The map is just an image in the 0.9 version of Sharpmap, so you can just put the MapImage control in a panel, I would think.

In regards your second problem, on first glance (since I don't have your shapefile), I'd say you are setting the point relative to your view - 120, 60 sounds like screen coordinates, not shapefile world coordinates. Try converting using Map.ViewToWorld() first.
Mar 7, 2007 at 1:32 AM
you have to convert the coord to image from world

public SharpMap.Geometries.Point CovertImageCoordsToMap(Map pmapMap, int pintImageX, int pintImageY)
return pmapMap.ImageToWorld(new System.Drawing.Point(pintImageX, pintImageY));

use this function to convert the image coords in to world coords and the do the new center

Mar 7, 2007 at 7:39 AM
Thank you both very much for your replies!

Well the problem is I'm working with the pocketterra compact framework version of SharpMap, which doesn't support MapImage (well at least I didn't find it). I haven't found a newer mobile version and it's probably not possible just to add the missing parts to the mobile SharpMap library. I know that there probably have to be done some changes to the code because of the compact framework GDI restrictions, but I don't know enough about it.

Thank you very much for your function! I'll give it a try now.
May 16, 2007 at 3:59 PM

I going to try to port the missings part of SharpMap v. 0.9 to the compact framework.

I need help!!!! What parts are missing???

Thanks in advantage!
May 16, 2007 at 9:09 PM
Edited May 16, 2007 at 9:09 PM
Hi VansFannel:

I have a special .dll of SharpMap for the compact framework, it works very nice, I can understand yor problem clearly but please send me more details about your problem..

May 17, 2007 at 6:46 AM
Hi moradoxy , what kind of dll do u have for pocket p?
May 17, 2007 at 1:38 PM
I have a special dll from pocket, this dll was from, I know that the diference between the dll for desktop/web VS pocket, is with the System.Drawing library.

If you want the dll send me a e-mail to the next address: "", I am developing a project for pocket pc, if you some code send me a message to.

May 17, 2007 at 3:24 PM
Hi moradoxy!

I'm sorry. I have not seen your post before.

I've been reading some post from other people about some parts of Sharpmap v.0.9 that have not been port to compact framework but I don't know what parts are.

I have the pocketterra version. Do you have made changes on this version?

Sorry for my english.

May 17, 2007 at 7:07 PM
Hi VansFannel:

No, I did not any changes, the dll works well, maybe during others changes the dll do not work well, but if you want my dll I send you, Try it.. send me a mail.