Como: Design a Layout Windows Forms that Responds Well to Localization
System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Text;
System.Windows.Forms;
TableLayoutPanelSample
{
LocalizableForm : Form
{
System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
System.Windows.Forms.ListView listView1;
System.Windows.Forms.Panel panel1;
System.Windows.Forms.Button button3;
System.Windows.Forms.Button button2;
System.Windows.Forms.Button button1;
System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
System.Windows.Forms.Button button4;
System.Windows.Forms.Button button5;
System.Windows.Forms.Button button6;
System.Windows.Forms.Label label1;
System.ComponentModel.IContainer components = ;
LocalizableForm()
{
InitializeComponent();
}
AddText(object sender, EventArgs e)
{
((Button)sender).Text += ;
}
Dispose( disposing)
{
(disposing && (components != ))
{
components.Dispose();
}
.Dispose(disposing);
}
InitializeComponent()
{
System.Windows.Forms.ListViewGroup listViewGroup16 = System.Windows.Forms.ListViewGroup(, System.Windows.Forms.HorizontalAlignment.Left);
System.Windows.Forms.ListViewGroup listViewGroup17 = System.Windows.Forms.ListViewGroup(, System.Windows.Forms.HorizontalAlignment.Left);
System.Windows.Forms.ListViewGroup listViewGroup18 = System.Windows.Forms.ListViewGroup(, System.Windows.Forms.HorizontalAlignment.Left);
System.Windows.Forms.ListViewItem listViewItem26 = System.Windows.Forms.ListViewItem();
System.Windows.Forms.ListViewItem listViewItem27 = System.Windows.Forms.ListViewItem();
System.Windows.Forms.ListViewItem listViewItem28 = System.Windows.Forms.ListViewItem();
System.Windows.Forms.ListViewItem listViewItem29 = System.Windows.Forms.ListViewItem();
System.Windows.Forms.ListViewItem listViewItem30 = System.Windows.Forms.ListViewItem();
.tableLayoutPanel1 = System.Windows.Forms.TableLayoutPanel();
.listView1 = System.Windows.Forms.ListView();
.panel1 = System.Windows.Forms.Panel();
.button3 = System.Windows.Forms.Button();
.button2 = System.Windows.Forms.Button();
.button1 = System.Windows.Forms.Button();
.tableLayoutPanel2 = System.Windows.Forms.TableLayoutPanel();
.button4 = System.Windows.Forms.Button();
.button5 = System.Windows.Forms.Button();
.button6 = System.Windows.Forms.Button();
.label1 = System.Windows.Forms.Label();
.tableLayoutPanel1.SuspendLayout();
.panel1.SuspendLayout();
.tableLayoutPanel2.SuspendLayout();
.SuspendLayout();
.tableLayoutPanel1.ColumnCount = 2;
.tableLayoutPanel1.ColumnStyles.Add( System.Windows.Forms.ColumnStyle());
.tableLayoutPanel1.ColumnStyles.Add( System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
.tableLayoutPanel1.Controls.Add(.listView1, 1, 0);
.tableLayoutPanel1.Controls.Add(.panel1, 0, 0);
.tableLayoutPanel1.Location = System.Drawing.Point(2, 52);
.tableLayoutPanel1.Name = ;
.tableLayoutPanel1.RowCount = 1;
.tableLayoutPanel1.RowStyles.Add( System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
.tableLayoutPanel1.Size = System.Drawing.Size(524, 270);
.tableLayoutPanel1.TabIndex = 1;
.listView1.Dock = System.Windows.Forms.DockStyle.Fill;
listViewGroup16.Header = ;
listViewGroup16.Name = ;
listViewGroup17.Header = ;
listViewGroup17.Name = ;
listViewGroup18.Header = ;
listViewGroup18.Name = ;
.listView1.Groups.AddRange( System.Windows.Forms.ListViewGroup[] {
listViewGroup16,
listViewGroup17,
listViewGroup18});
listViewItem26.Group = listViewGroup16;
listViewItem27.Group = listViewGroup16;
listViewItem28.Group = listViewGroup17;
listViewItem29.Group = listViewGroup17;
listViewItem30.Group = listViewGroup18;
.listView1.Items.AddRange( System.Windows.Forms.ListViewItem[] {
listViewItem26,
listViewItem27,
listViewItem28,
listViewItem29,
listViewItem30});
.listView1.Location = System.Drawing.Point(90, 3);
.listView1.Name = ;
.listView1.Size = System.Drawing.Size(431, 264);
.listView1.TabIndex = 1;
.panel1.Anchor = System.Windows.Forms.AnchorStyles.Top;
.panel1.AutoSize = ;
.panel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
.panel1.Controls.Add(.button3);
.panel1.Controls.Add(.button2);
.panel1.Controls.Add(.button1);
.panel1.Location = System.Drawing.Point(3, 3);
.panel1.Name = ;
.panel1.Size = System.Drawing.Size(81, 86);
.panel1.TabIndex = 2;
.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
.button3.AutoSize = ;
.button3.Location = System.Drawing.Point(3, 60);
.button3.Name = ;
.button3.TabIndex = 2;
.button3.Text = ;
.button3.Click += System.EventHandler(.AddText);
.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
.button2.AutoSize = ;
.button2.Location = System.Drawing.Point(3, 31);
.button2.Name = ;
.button2.TabIndex = 1;
.button2.Text = ;
.button2.Click += System.EventHandler(.AddText);
.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
.button1.AutoSize = ;
.button1.Location = System.Drawing.Point(3, 2);
.button1.Name = ;
.button1.TabIndex = 0;
.button1.Text = ;
.button1.Click += System.EventHandler(.AddText);
.tableLayoutPanel2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
.tableLayoutPanel2.AutoSize = ;
.tableLayoutPanel2.ColumnCount = 3;
.tableLayoutPanel2.ColumnStyles.Add( System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
.tableLayoutPanel2.ColumnStyles.Add( System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
.tableLayoutPanel2.ColumnStyles.Add( System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
.tableLayoutPanel2.Controls.Add(.button4, 0, 0);
.tableLayoutPanel2.Controls.Add(.button5, 1, 0);
.tableLayoutPanel2.Controls.Add(.button6, 2, 0);
.tableLayoutPanel2.Location = System.Drawing.Point(284, 328);
.tableLayoutPanel2.Name = ;
.tableLayoutPanel2.RowCount = 1;
.tableLayoutPanel2.RowStyles.Add( System.Windows.Forms.RowStyle());
.tableLayoutPanel2.Size = System.Drawing.Size(243, 34);
.tableLayoutPanel2.TabIndex = 2;
.button4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
.button4.AutoSize = ;
.button4.Location = System.Drawing.Point(3, 5);
.button4.Name = ;
.button4.TabIndex = 0;
.button4.Text = ;
.button4.Click += System.EventHandler(.AddText);
.button5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
.button5.AutoSize = ;
.button5.Location = System.Drawing.Point(84, 5);
.button5.Name = ;
.button5.TabIndex = 1;
.button5.Text = ;
.button5.Click += System.EventHandler(.AddText);
.button6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
.button6.AutoSize = ;
.button6.Location = System.Drawing.Point(165, 5);
.button6.Name = ;
.button6.TabIndex = 2;
.button6.Text = ;
.button6.Click += System.EventHandler(.AddText);
.label1.Location = System.Drawing.Point(8, 7);
.label1.Name = ;
.label1.Size = System.Drawing.Size(518, 40);
.label1.TabIndex = 3;
.label1.Text = +
+
;
.ClientSize = System.Drawing.Size(539, 374);
.Controls.Add(.label1);
.Controls.Add(.tableLayoutPanel2);
.Controls.Add(.tableLayoutPanel1);
.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
.Name = ;
.Text = ;
.tableLayoutPanel1.ResumeLayout();
.tableLayoutPanel1.PerformLayout();
.panel1.ResumeLayout();
.panel1.PerformLayout();
.tableLayoutPanel2.ResumeLayout();
.tableLayoutPanel2.PerformLayout();
.ResumeLayout();
.PerformLayout();
}
[STAThread]
Main()
{
Application.EnableVisualStyles();
Application.Run( LocalizableForm());
}
}
}
-
Referências para o Sistema, Sistema.Data, Sistema.Drawing e Sistema. Windows.Forms conjuntos.