Dock Top and Bottom : Dock « GUI Windows Forms « C# / CSharp Tutorial






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());
  }
}








23.58.Dock
23.58.1.Dock Top and BottomDock Top and Bottom
23.58.2.All DockStyles illustration
23.58.3.Dock to four directions and fill