what is wrong with this code ?

Sep 30, 2006 at 7:58 PM
i am developing a desktop applicatoion. i am not able to view the map,
it showing a blank screen. iam running this application on visual c# 2005

namespace WindowsApplication1
public partial class Form1 : Form
private SharpMap.Map myMap;
public Form1()

private void Form1_Load(object sender, EventArgs e)

myMap = InitializeMap(new System.Drawing.Size(300,400));

//This is the initial view of the map. Zoom to the extents of the map:
myMap.Zoom = myMap.GetExtents().Width;
myMap.Center = myMap.GetExtents().GetCentroid();
//Save the current mapcenter and zoom in the viewstate

//Create the map


private void Form1_Click(object sender, EventArgs e)


private SharpMap.Map InitializeMap(System.Drawing.Size outputsize)

SharpMap.Map map = new SharpMap.Map(outputsize);
SharpMap.Layers.VectorLayer layCountries = new SharpMap.Layers.VectorLayer("Countries");
layCountries.DataSource = new SharpMap.Data.Providers.ShapeFile(@"C:\Documents and Settings\user\Desktop\demo\App_Data\countries.shp");
layCountries.Style.Fill = new SolidBrush(Color.Green);
//Set the polygons to have a black outline
layCountries.Style.Outline = System.Drawing.Pens.Black;
layCountries.Style.EnableOutline = true;
SharpMap.Layers.VectorLayer layRivers = new SharpMap.Layers.VectorLayer("Rivers");
layRivers.DataSource = new SharpMap.Data.Providers.ShapeFile(@"C:\Documents and Settings\user\Desktop\demo\App_Data\rivers.shp");
layRivers.Style.Line = new Pen(Color.Blue, 1);
return map;


private void CreateMap()
Image img = myMap.GetMap();



thanks & regards
Sep 30, 2006 at 11:44 PM
You should post your question in one of the SharpMap forums:


This is the forum for questions/issues with the CodePlex site itself.