mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-17 01:41:17 -10:00
* Fix layout of scrollbars in combobox. * Fix TextBox height fixup to work properly inside TableLayout. * Fix changing TextBox font before the Control handle has been created. * Add test case. * Reintroduce fix for TextBoxTest.Bug82749. We need to save the user requested control bounds outside of ExplicitBounds since ExplicitBounds are used by table layout engine.
173 lines
6.7 KiB
C#
173 lines
6.7 KiB
C#
using System;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Test
|
|
{
|
|
static class Program
|
|
{
|
|
/// <summary>
|
|
/// Der Haupteinstiegspunkt für die Anwendung.
|
|
/// </summary>
|
|
[STAThread]
|
|
static void Main()
|
|
{
|
|
Application.EnableVisualStyles();
|
|
Application.SetCompatibleTextRenderingDefault(false);
|
|
Application.Run(new Form1());
|
|
}
|
|
}
|
|
|
|
public partial class Form1 : Form
|
|
{
|
|
public Form1()
|
|
{
|
|
InitializeComponent();
|
|
this.comboBox1.AutoSize = true; // necessary in Windows .Net to avoid wrong behaviour in TableLayout in particular wrong positioning
|
|
this.comboBox1.DataSource = new string[] { "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen" };
|
|
this.Font = new Font(DefaultFont.FontFamily.Name, DefaultFont.Size * 2.0f); // double font size for the whole form i.e. including all controls
|
|
}
|
|
|
|
/// <summary>
|
|
/// Erforderliche Designervariable.
|
|
/// </summary>
|
|
private System.ComponentModel.IContainer components = null;
|
|
|
|
/// <summary>
|
|
/// Verwendete Ressourcen bereinigen.
|
|
/// </summary>
|
|
/// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
if (disposing && (components != null))
|
|
{
|
|
components.Dispose();
|
|
}
|
|
base.Dispose(disposing);
|
|
}
|
|
|
|
#region Vom Windows Form-Designer generierter Code
|
|
|
|
/// <summary>
|
|
/// Erforderliche Methode für die Designerunterstützung.
|
|
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
|
|
/// </summary>
|
|
private void InitializeComponent()
|
|
{
|
|
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
|
this.label1 = new System.Windows.Forms.Label();
|
|
this.label2 = new System.Windows.Forms.Label();
|
|
this.label3 = new System.Windows.Forms.Label();
|
|
this.comboBox1 = new System.Windows.Forms.ComboBox();
|
|
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
|
|
this.textBox1 = new System.Windows.Forms.TextBox();
|
|
this.tableLayoutPanel1.SuspendLayout();
|
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
|
|
this.SuspendLayout();
|
|
//
|
|
// tableLayoutPanel1
|
|
//
|
|
this.tableLayoutPanel1.ColumnCount = 2;
|
|
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
|
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
|
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0);
|
|
this.tableLayoutPanel1.Controls.Add(this.label2, 0, 1);
|
|
this.tableLayoutPanel1.Controls.Add(this.label3, 0, 2);
|
|
this.tableLayoutPanel1.Controls.Add(this.comboBox1, 1, 1);
|
|
this.tableLayoutPanel1.Controls.Add(this.numericUpDown1, 1, 0);
|
|
this.tableLayoutPanel1.Controls.Add(this.textBox1, 1, 2);
|
|
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
|
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
|
this.tableLayoutPanel1.RowCount = 3;
|
|
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
|
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
|
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
|
this.tableLayoutPanel1.Size = new System.Drawing.Size(184, 162);
|
|
this.tableLayoutPanel1.TabIndex = 0;
|
|
//
|
|
// label1
|
|
//
|
|
this.label1.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
|
this.label1.AutoSize = true;
|
|
this.label1.Location = new System.Drawing.Point(3, 20);
|
|
this.label1.Margin = new System.Windows.Forms.Padding(3);
|
|
this.label1.Name = "label1";
|
|
this.label1.Size = new System.Drawing.Size(35, 13);
|
|
this.label1.TabIndex = 0;
|
|
this.label1.Text = "label1";
|
|
//
|
|
// label2
|
|
//
|
|
this.label2.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
|
this.label2.AutoSize = true;
|
|
this.label2.Location = new System.Drawing.Point(3, 74);
|
|
this.label2.Margin = new System.Windows.Forms.Padding(3);
|
|
this.label2.Name = "label2";
|
|
this.label2.Size = new System.Drawing.Size(35, 13);
|
|
this.label2.TabIndex = 1;
|
|
this.label2.Text = "label2";
|
|
//
|
|
// label3
|
|
//
|
|
this.label3.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
|
this.label3.AutoSize = true;
|
|
this.label3.Location = new System.Drawing.Point(3, 128);
|
|
this.label3.Margin = new System.Windows.Forms.Padding(3);
|
|
this.label3.Name = "label3";
|
|
this.label3.Size = new System.Drawing.Size(35, 13);
|
|
this.label3.TabIndex = 2;
|
|
this.label3.Text = "label3";
|
|
//
|
|
// comboBox1
|
|
//
|
|
this.comboBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
|
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
|
this.comboBox1.Location = new System.Drawing.Point(44, 70);
|
|
this.comboBox1.Name = "comboBox1";
|
|
this.comboBox1.Size = new System.Drawing.Size(137, 21);
|
|
this.comboBox1.TabIndex = 4;
|
|
//
|
|
// numericUpDown1
|
|
//
|
|
this.numericUpDown1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
|
this.numericUpDown1.Location = new System.Drawing.Point(44, 17);
|
|
this.numericUpDown1.Name = "numericUpDown1";
|
|
this.numericUpDown1.Size = new System.Drawing.Size(137, 20);
|
|
this.numericUpDown1.TabIndex = 5;
|
|
//
|
|
// textBox1
|
|
//
|
|
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
|
this.textBox1.Location = new System.Drawing.Point(44, 125);
|
|
this.textBox1.Name = "textBox1";
|
|
this.textBox1.Size = new System.Drawing.Size(137, 20);
|
|
this.textBox1.TabIndex = 6;
|
|
this.textBox1.Text = "test";
|
|
//
|
|
// Form1
|
|
//
|
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
|
this.ClientSize = new System.Drawing.Size(184, 162);
|
|
this.Controls.Add(this.tableLayoutPanel1);
|
|
this.Name = "Form1";
|
|
this.Text = "Form1";
|
|
this.tableLayoutPanel1.ResumeLayout(false);
|
|
this.tableLayoutPanel1.PerformLayout();
|
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
|
|
this.ResumeLayout(false);
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
|
private System.Windows.Forms.Label label1;
|
|
private System.Windows.Forms.Label label2;
|
|
private System.Windows.Forms.Label label3;
|
|
private System.Windows.Forms.ComboBox comboBox1;
|
|
private System.Windows.Forms.NumericUpDown numericUpDown1;
|
|
private System.Windows.Forms.TextBox textBox1;
|
|
}
|
|
}
|