Reputation: 81
I am encountering an problem with TableLayoutPanel
. I have configured that my size of table columns and rows are mostly dynamic, but the dynamic scaling isn't working after I have saved or done other changes(Can't say when exactly this problem started) and I am trying to resize the table borders. My configuration for my table is shown below:
example1 http://dl.dropbox.com/s/4ayi073x6xfxokb/configuration.jpg
No change example(the white square is just photoediting..):
example2 http://dl.dropbox.com/s/08zhm19264r3qzf/original.jpg
With border resize example:
example3 http://dl.dropbox.com/s/gelxjb8s2ip5bzj/after.jpg
Here it should have scaled accordingly to the resized borders, but it doesn't. I could not find an answer in google that was near to my situation, but what am I doing wrong, because the first time when i was creating and resizing the table, it was working perfectly as i wanted.
Added the designer.cs code for the TableLayoutPanel:
//
// tableLayoutPanel2
//
this.tableLayoutPanel2.ColumnCount = 5;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 50F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel2.Controls.Add(this.buttonFirstClockSecondDay_Type_A, 3, 1);
this.tableLayoutPanel2.Controls.Add(this.textBox1, 1, 0);
this.tableLayoutPanel2.Controls.Add(this.textBox2, 2, 0);
this.tableLayoutPanel2.Controls.Add(this.label5, 0, 1);
this.tableLayoutPanel2.Controls.Add(this.label1, 0, 3);
this.tableLayoutPanel2.Controls.Add(this.label6, 0, 5);
this.tableLayoutPanel2.Controls.Add(this.label7, 0, 7);
this.tableLayoutPanel2.Controls.Add(this.buttonFirstClockFirstDay_Type_A, 1, 1);
this.tableLayoutPanel2.Controls.Add(this.buttonFirstClockFirstDay_Type_B, 1, 2);
this.tableLayoutPanel2.Controls.Add(this.buttonSecondClockFirstDay_Type_A, 1, 3);
this.tableLayoutPanel2.Controls.Add(this.buttonSecondClockFirstDay_Type_B, 1, 4);
this.tableLayoutPanel2.Controls.Add(this.buttonFirstClockSecondDay_Type_B, 3, 2);
this.tableLayoutPanel2.Controls.Add(this.buttonSecondClockSecondDay_Type_A, 3, 3);
this.tableLayoutPanel2.Controls.Add(this.buttonSecondClockSecondDay_Type_B, 3, 4);
this.tableLayoutPanel2.Controls.Add(this.buttonThirdClockFirstDay_Type_A, 1, 5);
this.tableLayoutPanel2.Controls.Add(this.buttonThirdClockFirstDay_Type_B, 1, 6);
this.tableLayoutPanel2.Controls.Add(this.buttonFourthClockFirstDay_Type_A, 1, 7);
this.tableLayoutPanel2.Controls.Add(this.buttonFourthClockFirstDay_Type_B, 1, 8);
this.tableLayoutPanel2.Controls.Add(this.buttonThirdClockSecondDay_Type_A, 3, 5);
this.tableLayoutPanel2.Controls.Add(this.buttonThirdClockSecondDay_Type_B, 3, 6);
this.tableLayoutPanel2.Controls.Add(this.buttonFourthClockSecondDay_Type_A, 3, 7);
this.tableLayoutPanel2.Controls.Add(this.buttonFourthClockSecondDay_Type_B, 3, 8);
this.tableLayoutPanel2.Controls.Add(this.label3, 2, 1);
this.tableLayoutPanel2.Controls.Add(this.label2, 2, 2);
this.tableLayoutPanel2.Controls.Add(this.label8, 2, 3);
this.tableLayoutPanel2.Controls.Add(this.label4, 2, 4);
this.tableLayoutPanel2.Controls.Add(this.label14, 2, 5);
this.tableLayoutPanel2.Controls.Add(this.label13, 2, 6);
this.tableLayoutPanel2.Controls.Add(this.label15, 2, 7);
this.tableLayoutPanel2.Controls.Add(this.label19, 2, 8);
this.tableLayoutPanel2.Controls.Add(this.label10, 4, 1);
this.tableLayoutPanel2.Controls.Add(this.label11, 4, 2);
this.tableLayoutPanel2.Controls.Add(this.label9, 4, 3);
this.tableLayoutPanel2.Controls.Add(this.label12, 4, 4);
this.tableLayoutPanel2.Controls.Add(this.label17, 4, 5);
this.tableLayoutPanel2.Controls.Add(this.label18, 4, 6);
this.tableLayoutPanel2.Controls.Add(this.label16, 4, 7);
this.tableLayoutPanel2.Controls.Add(this.label20, 4, 8);
this.tableLayoutPanel2.Location = new System.Drawing.Point(382, 56);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 9;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(437, 288);
this.tableLayoutPanel2.TabIndex = 6;
this.tableLayoutPanel2.Paint += new System.Windows.Forms.PaintEventHandler(this.tableLayoutPanel2_Paint);
Upvotes: 2
Views: 3170
Reputation: 81
For some reason after reloading the solution it works again. It is a mystery why it did not work before..
Upvotes: 3
Reputation: 39132
The first picture has drag handles which indicates it was taken at design-time.
The second picture does NOT have drag handles which means it was taken at run-time? Did you change the size of the FORM?
To make the TableLayoutPanel change size with the Form you need to either:
Use the Anchor() property of the TableLayoutPanel and turn ON all four sides.
Set the Dock() property of the TableLayoutPanel to Fill.
Which is a better approach depends on your overall Form layout, which we cannot see.
Upvotes: 1