/* * A C# program that performs a simple layout. * It puts a growable text entry box with a button * on the top with a text box in the middle. * * Ben Bederson, March 18, 2002 */ using System; using System.Drawing; using System.Drawing.Drawing2D; using System.Windows.Forms; public class SimpleLayout : System.Windows.Forms.Form { TextBox urlBox; Button goButton; TextBox html; static public void Main() { Application.Run(new SimpleLayout()); } public SimpleLayout() { Size = new Size(400, 400); StartPosition = FormStartPosition.CenterScreen; CreateInterface(); } void CreateInterface() { goButton = new Button(); goButton.Text = "Go"; goButton.Location = new Point(ClientRectangle.Width - goButton.Width, 0); goButton.Anchor = AnchorStyles.Top | AnchorStyles.Right; urlBox = new TextBox(); urlBox.Bounds = new Rectangle(0, 0, ClientRectangle.Width - goButton.Width, goButton.Height); urlBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; html = new TextBox(); html.Multiline = true; html.ScrollBars = ScrollBars.Both; html.WordWrap = false; html.Bounds = new Rectangle(0, goButton.Height, ClientRectangle.Width, ClientRectangle.Height - goButton.Height); html.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; Controls.AddRange(new Control[] {goButton, urlBox, html} ); } }