Prod.: Engine, ver.: 6, ID: 60000706, HowTo : Comma and dot display problem (regional settings) in Property Grid

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

Article60000706
TypeHowTo
ProductEngine
Version6
Date Added12/9/2008
Submitted byB Harati
Keywords

Subject

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

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
    }
}