Setting the label to center within a tablelayout panel

Shaifali jain 420 Reputation points
2023-09-17T14:03:27.11+00:00

Hello ,

i have used a tablelayout panel in my form and on its first row ,i have dragged a label control on it . i am trying to move it to the centre of the first row but its like stuck on the left side . how to move it to the centre of the row .

this is i having
User's image

and this is what i want (on the centre of first row and first column ) .
User's image

(the above screenshot i get , is by holding the label with the mouse cursor and then press the printscreen button)

   // tableLayoutPanel3
            // 
            this.tableLayoutPanel3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(184)))), ((int)(((byte)(224)))), ((int)(((byte)(184)))));
            this.tableLayoutPanel3.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single;
            this.tableLayoutPanel3.ColumnCount =4 ;
            this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
            this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
            this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
            this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
           
         
            this.tableLayoutPanel3.Controls.Add(this.label5, 0, 0);
            this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Bottom;
            this.tableLayoutPanel3.Location = new System.Drawing.Point(0, 844);
            this.tableLayoutPanel3.Name = "tableLayoutPanel3";
            this.tableLayoutPanel3.RowCount = 2;
            this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20.69565F));
            this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 79.30435F));
            this.tableLayoutPanel3.Size = new System.Drawing.Size(1227, 100);
            this.tableLayoutPanel3.TabIndex = 7;
Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,844 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,326 questions
0 comments No comments
{count} votes

0 additional answers

Sort by: Most helpful