Geekpedia Programming Tutorials






TableLayoutPanel.LayoutSettings

On Friday, May 9th 2008 at 01:43 AM
By Jaakko Salmenius
When TableLayoutPanel writes LayoutSettings and the settings contain value
having decimal separator (e.g. 5.4) .NET writes the decimal using the
decimal point of the current locale. For example if I have the following
value

<data name="tableLayoutPanel1.LayoutSettings"
type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
<value>&lt;?xml version="1.0"
encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control
Name="button2" Row="1" RowSpan="1" Column="0" ColumnSpan="1"
/&gt;&lt;Control Name="button1" Row="0" RowSpan="1" Column="0"
ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="Percent,100"
/&gt;&lt;Rows Styles="Percent,20,1,Percent,79,9"
/&gt;&lt;/TableLayoutSettings&gt;</value>
</data>

It is a bit hard to read but the important part is
"Percent,20,1,Percent,79,9". Here the item separator is , but my form was
written on Windows having default localize set to Finnish so it uses Finnish
decimal separator (,) instead of English (.). Saving the same data on
English settins produces "Percent,20.1,Percent,79.9".

Is this a bit odd. If developer A using Finnish locale create the form and
sends it to his American colleque .NET can not read the data correctly.

My opinion is that on .resx the decimal value should always written using .
and not national decimal separator.

Is there bug in .NET framework or am I missing something?

Microsoft! If you could include full source code of .NET with SDK like
CodeGear does with VCL I could have solved this myself. What is the point
that there is no .NET source code available. I just don't get it.

Best regards,
Jaakko Salmenius
http://www.sisulizer.com - Three simple steps to localize

Re: TableLayoutPanel.LayoutSettings

by Garrett McGowan \(MSFT\) on Friday, May 23rd 2008 at 08:03 PM
Hello Jaakko. This is a very interesting issue - thank you for raising it.
I agree that while it's fine to format the values that are displayed on the
Column and Row Styles dialog, invariant formatting should be used to
persist them in the RESX file.

As it happens though, there don't appear to be any noticable affects
at runtime. Because these are percentages, the sizes are relative. For
example, one column could be set to 2490.00% with another at 7510.00%,
and they would render the same as ones with settings of 24.90% and
75.10%, respectively.

Your point is valid though, and I'll log a bug report so that the team
investigates it further.

As to .NET Framework source code availability - it is available in
read-only form, though not shipped as part of the SDK. Please see
Scott Guthrie's blog entry on this subject:
http://weblogs.asp.net/scottgu/archive/2008/01/16/net-framework-library-source-code-now-available.aspx

Cheers,
Garrett McGowan [MSFT Developer International]

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

"Jaakko Salmenius" <jaakko.salmenius@gmail.com> wrote in message
news:F11516E2-33DA-4047-8E2F-205DF4AB09E5@microsoft.com...
> When TableLayoutPanel writes LayoutSettings and the settings contain value
> having decimal separator (e.g. 5.4) .NET writes the decimal using the
> decimal point of the current locale. For example if I have the following
> value
>
> <data name="tableLayoutPanel1.LayoutSettings"
> type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
> <value>&lt;?xml version="1.0"
> encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control
> Name="button2" Row="1" RowSpan="1" Column="0" ColumnSpan="1"
> /&gt;&lt;Control Name="button1" Row="0" RowSpan="1" Column="0"
> ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="Percent,100"
> /&gt;&lt;Rows Styles="Percent,20,1,Percent,79,9"
> /&gt;&lt;/TableLayoutSettings&gt;</value>
> </data>
>
> It is a bit hard to read but the important part is
> "Percent,20,1,Percent,79,9". Here the item separator is , but my form was
> written on Windows having default localize set to Finnish so it uses
> Finnish decimal separator (,) instead of English (.). Saving the same data
> on English settins produces "Percent,20.1,Percent,79.9".
>
> Is this a bit odd. If developer A using Finnish locale create the form and
> sends it to his American colleque .NET can not read the data correctly.
>
> My opinion is that on .resx the decimal value should always written using
> . and not national decimal separator.
>
> Is there bug in .NET framework or am I missing something?
>
> Microsoft! If you could include full source code of .NET with SDK like
> CodeGear does with VCL I could have solved this myself. What is the point
> that there is no .NET source code available. I just don't get it.
>
> Best regards,
> Jaakko Salmenius
Latest Tech Bargains

Advertisement

Free Magazine Subscriptions

Today's Pictures

Today's Video

Other Resources

Latest Download

Latest Icons