AnchorStyles.Bottom | AnchorStyles.Right : Anchoring « GUI Windows Forms « C# / CSharp Tutorial






using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

  public class Form1 : Form
  {
    private TextBox messageBox;
    private Label label1;
    private Button sendButton;
    private Button clearButton;
    private System.ComponentModel.Container components = null;
    public Form1()
    {
      this.messageBox = new TextBox();
      this.label1 = new Label();
      this.sendButton = new Button();
      this.clearButton = new Button();
      this.SuspendLayout();
      // 
      this.messageBox.Anchor = ((AnchorStyles)(((AnchorStyles.Top | AnchorStyles.Left) 
        | AnchorStyles.Right)));
      this.messageBox.Font = new Font("Microsoft Sans Serif", 8.25F, 
                            FontStyle.Bold, GraphicsUnit.Point, ((System.Byte)(0)));
      this.messageBox.Location = new Point(8, 32);
      this.messageBox.Name = "messageBox";
      this.messageBox.Size = new Size(280, 20);
      this.messageBox.TabIndex = 0;
      this.messageBox.Text = "Type your Message here ...";
      // 
      this.label1.Font = new Font("Microsoft Sans Serif", 8.25F, 
                           FontStyle.Bold, GraphicsUnit.Point, ((System.Byte)(0)));
      this.label1.Location = new Point(8, 8);
      this.label1.Name = "label1";
      this.label1.Size = new Size(56, 16);
      this.label1.TabIndex = 1;
      this.label1.Text = "Message";
      // 
      this.sendButton.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right)));
      this.sendButton.Location = new Point(136, 72);
      this.sendButton.Name = "sendButton";
      this.sendButton.Size = new Size(72, 24);
      this.sendButton.TabIndex = 2;
      this.sendButton.Text = "Send";
      // 
      this.clearButton.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right)));
      this.clearButton.Location = new Point(216, 72);
      this.clearButton.Name = "clearButton";
      this.clearButton.Size = new Size(72, 24);
      this.clearButton.TabIndex = 3;
      this.clearButton.Text = "Clear";
      // 
      this.AutoScaleBaseSize = new Size(5, 13);
      this.ClientSize = new Size(292, 101);
      this.Controls.Add(this.clearButton);
      this.Controls.Add(this.sendButton);
      this.Controls.Add(this.label1);
      this.Controls.Add(this.messageBox);
      this.Name = "Form1";
      this.Text = "Anchoring Windows Forms Controls";
      this.ResumeLayout(false);
    }
    [STAThread]
    static void Main() 
    {
      Application.Run(new Form1());
    }
  }








23.57.Anchoring
23.57.1.Anchor and dockAnchor and dock
23.57.2.Control AnchoringControl Anchoring
23.57.3.AnchorStyles.Bottom | AnchorStyles.Right