Mega Code Archive

 
Categories / C# Tutorial / GUI Windows Forms
 

Dock Top and Bottom

using System; using System.Drawing; using System.Windows.Forms; public class ControlDock : Form {   public ControlDock()   {     Size = new Size(350,400);     int yButtonSize = Font.Height * 2;     Button btn = new Button();     btn.Parent = this;     btn.Text = "First Button";     btn.Height = yButtonSize;     btn.Dock = DockStyle.Top;     btn = new Button();     btn.Parent = this;     btn.Text = "Second Button";     btn.Height = yButtonSize;     btn.Dock = DockStyle.Bottom;   }   static void Main()    {     Application.Run(new ControlDock());   } }