60000706 Comma and dot display problem (regional settings) in Property Grid

Article 60000706
Type HowTo
Product Engine
Date Added 12/9/2008 12:00:00 AM
Fixed (12/9/2008 12:00:00 AM)
Submitted by B Harati

Summary

In my machine, due to regional settings (comma is the decimal separator, while dot is the grouping), I see my custom objects properties in the Properties Grid the decimal separator like MyLength : 10,034 as comma. While the other properties shown with dot like Radius : 3.12 . How can I change this ?

Solution

In order to display the custom object's properties values in the Property Grid with dot (.) as decimal separator then in your custom object's properties you can do this (below in BOLD) :

...........................
///
<summary>
///
Get/Set the width of the VectorDrawSimpleRect in drawing units.
///
</summary>
///
<remarks>
///
Default value 0.1.
///
</remarks>
///

[System.ComponentModel.TypeConverterAttribute(typeof(VectorDraw.Geometry.DoubleLinearConverter))]
public double Width
{
    get { return mWidth; }
    set
    {
        if (!RaiseOnBeforeModify("Width", value)) return;
        AddHistory("Width", value);
        mWidth = value;
        RaiseOnAfterModify("Width");
    }
}
...........................

The code above is from the sample CustomObjects, VectorDrawSimpleRect.cs source code for the SimpleRect custom object of the sample.
 
 
Similar for Angles use this :

[System.ComponentModel.TypeConverterAttribute(typeof((VectorDraw.Geometry.DoubleAngularConverter))]
public double EndAngle
{
    get
    {
        ...... Your code here
    }
    set
    {
        ...... Your code here
    }
}

Send comments on this topic.