I want to set the background color for a specific country. How would I do that?
Setting background color for a country
Hi George,
Thanks for your question!
The first item I need to understand is the datasource you are drawing this country from? To start I am going to assume you have this country in a shapefile.
Second does your shapefile contain multiple countries and you want to color one country a specific color or do you just need to setup a background color for your map that will have multiple countries on it?
If you only need to setup a background color for your map then I would recommend reviewing the Samples - Getting Started - Set the Background Color sample at websamples.thinkgeo.com.
Here we simply set the following:
Map1.MapBackground.BackgroundBrush = new GeoSolidBrush(GeoColor.FromArgb(backgroundColor.A, backgroundColor.R, backgroundColor.G, backgroundColor.B));
If you have multiple countries in your shapefile and want to set the color of one specifically you will need to use our ValueStyle as demonstrated in the Samples - Styles - Draw Features Based on a Value sample. In this sample you will see a ValueStyle.ColumnValue. This ColumnValue is found in the dbf of your shapefile and the ValueStyle searches this column for a the value you specify and colors as necessary.
Thanks
Hello George,
Please feel free to let us know when you meet problems.
Regards,
Gary