Как сделать так, что бы элементы масштабировались, при увеличении окна
Нужно сделать так что бы при увеличении окна, элементы масштабировались и оставались на своих местах. С помощью Anchor элементы расставил как надо, но они не увеличиваются. Погуглил, ничего конкретного про масштабируемость не нашел кроме метода Scale. Как его использовать не понимаю. Подскажите как "малой кровью" увеличивать элементы 
Код дизайнера
namespace WindowsFormsApp1
{
partial class Form1
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором форм Windows
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
private void InitializeComponent()
{
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label1 = new System.Windows.Forms.Label();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.label2 = new System.Windows.Forms.Label();
this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel();
this.pictureBox3 = new System.Windows.Forms.PictureBox();
this.label3 = new System.Windows.Forms.Label();
this.flowLayoutPanel4 = new System.Windows.Forms.FlowLayoutPanel();
this.pictureBox4 = new System.Windows.Forms.PictureBox();
this.label4 = new System.Windows.Forms.Label();
this.flowLayoutPanel5 = new System.Windows.Forms.FlowLayoutPanel();
this.pictureBox5 = new System.Windows.Forms.PictureBox();
this.label5 = new System.Windows.Forms.Label();
this.flowLayoutPanel6 = new System.Windows.Forms.FlowLayoutPanel();
this.pictureBox6 = new System.Windows.Forms.PictureBox();
this.label6 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.flowLayoutPanel1.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.flowLayoutPanel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
this.flowLayoutPanel3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
this.flowLayoutPanel4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit();
this.flowLayoutPanel5.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit();
this.flowLayoutPanel6.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).BeginInit();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.Anchor = System.Windows.Forms.AnchorStyles.None;
this.pictureBox1.Image = global::WindowsFormsApp1.Properties.Resources.заметки;
this.pictureBox1.Location = new System.Drawing.Point(3, 3);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(180, 180);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// label1
//
this.label1.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(70, 186);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(46, 17);
this.label1.TabIndex = 6;
this.label1.Text = "label1";
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.Anchor = System.Windows.Forms.AnchorStyles.None;
this.flowLayoutPanel1.AutoSize = true;
this.flowLayoutPanel1.Controls.Add(this.pictureBox1);
this.flowLayoutPanel1.Controls.Add(this.label1);
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPanel1.Location = new System.Drawing.Point(52, 54);
this.flowLayoutPanel1.MinimumSize = new System.Drawing.Size(186, 203);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(186, 203);
this.flowLayoutPanel1.TabIndex = 7;
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.AutoSize = true;
this.tableLayoutPanel1.ColumnCount = 3;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel6, 2, 1);
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel5, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel4, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel3, 2, 0);
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel2, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 0);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.GrowStyle = System.Windows.Forms.TableLayoutPanelGrowStyle.FixedSize;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(872, 622);
this.tableLayoutPanel1.TabIndex = 8;
//
// flowLayoutPanel2
//
this.flowLayoutPanel2.Anchor = System.Windows.Forms.AnchorStyles.None;
this.flowLayoutPanel2.AutoSize = true;
this.flowLayoutPanel2.Controls.Add(this.pictureBox2);
this.flowLayoutPanel2.Controls.Add(this.label2);
this.flowLayoutPanel2.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPanel2.Location = new System.Drawing.Point(342, 54);
this.flowLayoutPanel2.MinimumSize = new System.Drawing.Size(186, 203);
this.flowLayoutPanel2.Name = "flowLayoutPanel2";
this.flowLayoutPanel2.Size = new System.Drawing.Size(186, 203);
this.flowLayoutPanel2.TabIndex = 8;
//
// pictureBox2
//
this.pictureBox2.Anchor = System.Windows.Forms.AnchorStyles.None;
this.pictureBox2.Image = global::WindowsFormsApp1.Properties.Resources.заметки;
this.pictureBox2.Location = new System.Drawing.Point(3, 3);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(180, 180);
this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox2.TabIndex = 0;
this.pictureBox2.TabStop = false;
//
// label2
//
this.label2.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(70, 186);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(46, 17);
this.label2.TabIndex = 6;
this.label2.Text = "label2";
//
// flowLayoutPanel3
//
this.flowLayoutPanel3.Anchor = System.Windows.Forms.AnchorStyles.None;
this.flowLayoutPanel3.AutoSize = true;
this.flowLayoutPanel3.Controls.Add(this.pictureBox3);
this.flowLayoutPanel3.Controls.Add(this.label3);
this.flowLayoutPanel3.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPanel3.Location = new System.Drawing.Point(633, 54);
this.flowLayoutPanel3.MinimumSize = new System.Drawing.Size(186, 203);
this.flowLayoutPanel3.Name = "flowLayoutPanel3";
this.flowLayoutPanel3.Size = new System.Drawing.Size(186, 203);
this.flowLayoutPanel3.TabIndex = 9;
//
// pictureBox3
//
this.pictureBox3.Anchor = System.Windows.Forms.AnchorStyles.None;
this.pictureBox3.Image = global::WindowsFormsApp1.Properties.Resources.заметки;
this.pictureBox3.Location = new System.Drawing.Point(3, 3);
this.pictureBox3.Name = "pictureBox3";
this.pictureBox3.Size = new System.Drawing.Size(180, 180);
this.pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox3.TabIndex = 0;
this.pictureBox3.TabStop = false;
//
// label3
//
this.label3.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(70, 186);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(46, 17);
this.label3.TabIndex = 6;
this.label3.Text = "label3";
//
// flowLayoutPanel4
//
this.flowLayoutPanel4.Anchor = System.Windows.Forms.AnchorStyles.None;
this.flowLayoutPanel4.AutoSize = true;
this.flowLayoutPanel4.Controls.Add(this.pictureBox4);
this.flowLayoutPanel4.Controls.Add(this.label4);
this.flowLayoutPanel4.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPanel4.Location = new System.Drawing.Point(52, 365);
this.flowLayoutPanel4.MinimumSize = new System.Drawing.Size(186, 203);
this.flowLayoutPanel4.Name = "flowLayoutPanel4";
this.flowLayoutPanel4.Size = new System.Drawing.Size(186, 203);
this.flowLayoutPanel4.TabIndex = 10;
//
// pictureBox4
//
this.pictureBox4.Anchor = System.Windows.Forms.AnchorStyles.None;
this.pictureBox4.Image = global::WindowsFormsApp1.Properties.Resources.заметки;
this.pictureBox4.Location = new System.Drawing.Point(3, 3);
this.pictureBox4.Name = "pictureBox4";
this.pictureBox4.Size = new System.Drawing.Size(180, 180);
this.pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox4.TabIndex = 0;
this.pictureBox4.TabStop = false;
//
// label4
//
this.label4.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(70, 186);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(46, 17);
this.label4.TabIndex = 6;
this.label4.Text = "label4";
//
// flowLayoutPanel5
//
this.flowLayoutPanel5.Anchor = System.Windows.Forms.AnchorStyles.None;
this.flowLayoutPanel5.AutoSize = true;
this.flowLayoutPanel5.Controls.Add(this.pictureBox5);
this.flowLayoutPanel5.Controls.Add(this.label5);
this.flowLayoutPanel5.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPanel5.Location = new System.Drawing.Point(342, 365);
this.flowLayoutPanel5.MinimumSize = new System.Drawing.Size(186, 203);
this.flowLayoutPanel5.Name = "flowLayoutPanel5";
this.flowLayoutPanel5.Size = new System.Drawing.Size(186, 203);
this.flowLayoutPanel5.TabIndex = 11;
//
// pictureBox5
//
this.pictureBox5.Anchor = System.Windows.Forms.AnchorStyles.None;
this.pictureBox5.Image = global::WindowsFormsApp1.Properties.Resources.заметки;
this.pictureBox5.Location = new System.Drawing.Point(3, 3);
this.pictureBox5.Name = "pictureBox5";
this.pictureBox5.Size = new System.Drawing.Size(180, 180);
this.pictureBox5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox5.TabIndex = 0;
this.pictureBox5.TabStop = false;
//
// label5
//
this.label5.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(70, 186);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(46, 17);
this.label5.TabIndex = 6;
this.label5.Text = "label5";
//
// flowLayoutPanel6
//
this.flowLayoutPanel6.Anchor = System.Windows.Forms.AnchorStyles.None;
this.flowLayoutPanel6.AutoSize = true;
this.flowLayoutPanel6.Controls.Add(this.pictureBox6);
this.flowLayoutPanel6.Controls.Add(this.label6);
this.flowLayoutPanel6.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPanel6.Location = new System.Drawing.Point(633, 365);
this.flowLayoutPanel6.MinimumSize = new System.Drawing.Size(186, 203);
this.flowLayoutPanel6.Name = "flowLayoutPanel6";
this.flowLayoutPanel6.Size = new System.Drawing.Size(186, 203);
this.flowLayoutPanel6.TabIndex = 12;
//
// pictureBox6
//
this.pictureBox6.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.pictureBox6.Image = global::WindowsFormsApp1.Properties.Resources.заметки;
this.pictureBox6.Location = new System.Drawing.Point(3, 3);
this.pictureBox6.Name = "pictureBox6";
this.pictureBox6.Size = new System.Drawing.Size(180, 180);
this.pictureBox6.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox6.TabIndex = 0;
this.pictureBox6.TabStop = false;
//
// label6
//
this.label6.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(70, 186);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(46, 17);
this.label6.TabIndex = 6;
this.label6.Text = "label6";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSize = true;
this.ClientSize = new System.Drawing.Size(872, 622);
this.Controls.Add(this.tableLayoutPanel1);
this.MinimumSize = new System.Drawing.Size(800, 600);
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.flowLayoutPanel1.ResumeLayout(false);
this.flowLayoutPanel1.PerformLayout();
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.flowLayoutPanel2.ResumeLayout(false);
this.flowLayoutPanel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
this.flowLayoutPanel3.ResumeLayout(false);
this.flowLayoutPanel3.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
this.flowLayoutPanel4.ResumeLayout(false);
this.flowLayoutPanel4.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit();
this.flowLayoutPanel5.ResumeLayout(false);
this.flowLayoutPanel5.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit();
this.flowLayoutPanel6.ResumeLayout(false);
this.flowLayoutPanel6.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel6;
private System.Windows.Forms.PictureBox pictureBox6;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel5;
private System.Windows.Forms.PictureBox pictureBox5;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel4;
private System.Windows.Forms.PictureBox pictureBox4;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel3;
private System.Windows.Forms.PictureBox pictureBox3;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.Label label2;
}
}
Ответы (1 шт):
Автор решения: Георгий
→ Ссылка
Все оказалось куда проще, моя ошибка была в том, что я использовал в TableLayoutPanel FlowLayoutPanel. Помог также запрос "Все что вы хотели узнать о TableLayoutPanel, но боялись спросить". Надеюсь что кому то поможет.
Теперь все работает так:
#region Создаю TableLayoutPanel
this.Controls.Clear();
TableLayoutPanel tableLayoutPanel = new TableLayoutPanel
{
AutoSize = true,
CellBorderStyle = TableLayoutPanelCellBorderStyle.InsetDouble,
ColumnCount = 3,
Dock = DockStyle.Fill,
GrowStyle = TableLayoutPanelGrowStyle.FixedSize,
Location = new Point(0, 0),
RowCount = 2
};
this.Controls.Add(tableLayoutPanel);
tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F));
tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F));
tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F));
tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
#endregion
Panel panel1 = new Panel
{
Dock = DockStyle.Fill,
AutoSize = true,
MinimumSize = new Size(180, 180),
BorderStyle = BorderStyle.FixedSingle
};
tableLayoutPanel.Controls.Add(panel1, 0, 0);
PictureBox pic1 = new PictureBox
{
Dock = DockStyle.Fill,
Image = Properties.Resources.картинка,
MinimumSize = new Size(160, 160),
MaximumSize = new Size(350, 350),
SizeMode = PictureBoxSizeMode.Zoom
};
panel1.Controls.Add(pic1);
Panel panel11 = new Panel
{
Dock = DockStyle.Bottom,
AutoSize = true,
BorderStyle = BorderStyle.FixedSingle
};
panel1.Controls.Add(panel11);
Label lab1 = new Label
{
AutoSize = false,
Dock = DockStyle.Top,
Text = "Просто текст",
TextAlign = ContentAlignment.MiddleCenter
};
panel11.Controls.Add(lab1);


