Thousands Comma separator in Label

Topics: SharpMap Project, SharpMap v0.9 / v1.x, SharpMap v2.0, WinForms Controls
Sep 17, 2013 at 10:59 AM
Hi,

I am displaying values in polygon as labels, i need to have Thousands separator by comma for the labels.I am reading the values from Sql server database using the following line of code.
LayLabel.LabelColumn ="Value";               
LayLabel.Style = new LabelStyle();
LayLabel.Style.ForeColor = Color.Black;
I need the labels to be displayed as 124,000.00 instead of 124000.00 and for the legends i used string format to get the comma separator. Is it possible to get the expected result for labels.

Note: Its an urgent task please respond asap if anybody has the solution.

Regards
Arun Mohan
Coordinator
Sep 17, 2013 at 1:23 PM
Edited Sep 18, 2013 at 7:28 AM
sth like:
LayLabel.LabelStringDelegate = fdr => string.Format(NumberFormatInfo.InvariantInfo, "{0:N2}", fdr["Value"]);
Sep 18, 2013 at 6:24 AM
Hi FObermaier,

I am getting the following error

Error 3 'SharpMap.Styles.LabelStyle' does not contain a definition for 'LabelDelegate' and no extension method 'LabelDelegate' accepting a first argument of type 'SharpMap.Styles.LabelStyle' could be found (are you missing a using directive or an assembly reference?)

Please help me in this.

Regards
Arun Mohan
Coordinator
Sep 18, 2013 at 7:30 AM
Sorry,
  • the delegate does not belong to the LabelStyle, it is a member of the LabelLayer
  • it is named LabelStringDelegate and has the LabelLayer.GetLabelMethod signature.
Sep 18, 2013 at 9:20 AM
Hi FObermaier,

Thanks a lot , it worked

Regards
Arun Mohan