using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; namespace LayoutTest { /// /// Summary description for Form1. /// public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button1; /// /// Required designer variable. /// private System.ComponentModel.Container components = null; public Form1() { InitializeComponent(); DebugOutput(); } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.panel1 = new System.Windows.Forms.Panel(); this.button2 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button(); this.panel1.SuspendLayout(); this.SuspendLayout(); // // panel1 // this.panel1.BackColor = System.Drawing.Color.IndianRed; this.panel1.Controls.AddRange(new System.Windows.Forms.Control[] { this.button2, this.button1}); this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(304, 139); this.panel1.TabIndex = 0; this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint); // // button2 // this.button2.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right); this.button2.BackColor = System.Drawing.SystemColors.Control; this.button2.Location = new System.Drawing.Point(224, 40); this.button2.Name = "button2"; this.button2.TabIndex = 3; this.button2.Text = "button2"; this.button2.Paint += new System.Windows.Forms.PaintEventHandler(this.button2_Paint); // // button1 // this.button1.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right); this.button1.BackColor = System.Drawing.SystemColors.Control; this.button1.Location = new System.Drawing.Point(224, 8); this.button1.Name = "button1"; this.button1.TabIndex = 2; this.button1.Text = "button1"; this.button1.Paint += new System.Windows.Forms.PaintEventHandler(this.button1_Paint); // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(304, 139); this.Controls.AddRange(new System.Windows.Forms.Control[] { this.panel1}); this.Name = "Form1"; this.Text = "Form1"; this.panel1.ResumeLayout(false); this.ResumeLayout(false); } #endregion /// /// The main entry point for the application. /// [STAThread] static void Main() { Application.Run(new Form1()); } private void DebugOutput() { Console.WriteLine("Form1 SIZE: " + this.Size); Console.WriteLine("Panel1 LOCATION: " + panel1.Location + " SIZE: " + panel1.Size); Console.WriteLine("button1 LOCATION: " + button1.Location + " SIZE: " + button1.Size); Console.WriteLine("button2 LOCATION: " + button2.Location + " SIZE: " + button2.Size); Console.WriteLine(""); } private void button1_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { } private void button2_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { } private void panel1_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { DebugOutput(); } } }