<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FCSharp_Tutorial%2FGUI_Windows_Forms%2FForm</id>
		<title>Csharp/CSharp Tutorial/GUI Windows Forms/Form - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FCSharp_Tutorial%2FGUI_Windows_Forms%2FForm"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/GUI_Windows_Forms/Form&amp;action=history"/>
		<updated>2026-04-30T01:10:23Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/GUI_Windows_Forms/Form&amp;diff=5397&amp;oldid=prev</id>
		<title> в 15:31, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/GUI_Windows_Forms/Form&amp;diff=5397&amp;oldid=prev"/>
				<updated>2010-05-26T15:31:53Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 15:31, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/GUI_Windows_Forms/Form&amp;diff=5398&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/GUI_Windows_Forms/Form&amp;diff=5398&amp;oldid=prev"/>
				<updated>2010-05-26T12:15:18Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Add a Main Menu==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System; &lt;br /&gt;
using System.Windows.Forms; &lt;br /&gt;
 &lt;br /&gt;
class AddMenuForm : Form { &lt;br /&gt;
  MainMenu MyMenu; &lt;br /&gt;
 &lt;br /&gt;
  public AddMenuForm() { &lt;br /&gt;
    Text = &amp;quot;Adding a Main Menu&amp;quot;; &lt;br /&gt;
    MyMenu  = new MainMenu(); &lt;br /&gt;
 &lt;br /&gt;
    MenuItem m1 = new MenuItem(&amp;quot;File&amp;quot;); &lt;br /&gt;
    MyMenu.MenuItems.Add(m1); &lt;br /&gt;
 &lt;br /&gt;
    MenuItem m2 = new MenuItem(&amp;quot;Tools&amp;quot;); &lt;br /&gt;
    MyMenu.MenuItems.Add(m2); &lt;br /&gt;
 &lt;br /&gt;
    MenuItem subm1 = new MenuItem(&amp;quot;Open&amp;quot;); &lt;br /&gt;
    m1.MenuItems.Add(subm1); &lt;br /&gt;
 &lt;br /&gt;
    MenuItem subm2 = new MenuItem(&amp;quot;Close&amp;quot;); &lt;br /&gt;
    m1.MenuItems.Add(subm2); &lt;br /&gt;
 &lt;br /&gt;
    MenuItem subm3 = new MenuItem(&amp;quot;Exit&amp;quot;); &lt;br /&gt;
    m1.MenuItems.Add(subm3); &lt;br /&gt;
 &lt;br /&gt;
    MenuItem subm4 = new MenuItem(&amp;quot;Coordinates&amp;quot;); &lt;br /&gt;
    m2.MenuItems.Add(subm4); &lt;br /&gt;
 &lt;br /&gt;
    MenuItem subm5 = new MenuItem(&amp;quot;Change Size&amp;quot;); &lt;br /&gt;
    m2.MenuItems.Add(subm5); &lt;br /&gt;
 &lt;br /&gt;
    MenuItem subm6 = new MenuItem(&amp;quot;Restore&amp;quot;); &lt;br /&gt;
    m2.MenuItems.Add(subm6); &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
    subm1.Click += MMOpenClick; &lt;br /&gt;
    subm2.Click += MMCloseClick; &lt;br /&gt;
    subm3.Click += MMExitClick; &lt;br /&gt;
    subm4.Click += MMCoordClick; &lt;br /&gt;
    subm5.Click += MMChangeClick; &lt;br /&gt;
    subm6.Click += MMRestoreClick; &lt;br /&gt;
 &lt;br /&gt;
    Menu = MyMenu; &lt;br /&gt;
  }   &lt;br /&gt;
 &lt;br /&gt;
  [STAThread] &lt;br /&gt;
  public static void Main() { &lt;br /&gt;
    AddMenuForm skel = new AddMenuForm(); &lt;br /&gt;
 &lt;br /&gt;
    Application.Run(skel); &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  protected void MMCoordClick(object who, EventArgs e) { &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  protected void MMChangeClick(object who, EventArgs e) { &lt;br /&gt;
    &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  protected void MMRestoreClick(object who, EventArgs e) { &lt;br /&gt;
    &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  protected void MMOpenClick(object who, EventArgs e) { &lt;br /&gt;
 &lt;br /&gt;
    Console.WriteLine(&amp;quot;MMOpenClick&amp;quot;); &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  protected void MMCloseClick(object who, EventArgs e) { &lt;br /&gt;
    Console.WriteLine(&amp;quot;MMCloseClick&amp;quot;); &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  protected void MMExitClick(object who, EventArgs e) { &lt;br /&gt;
     Console.WriteLine(&amp;quot;Exit&amp;quot;); &lt;br /&gt;
  } &lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Add control to Form dynamically==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
   &lt;br /&gt;
public class MainForm : Form&lt;br /&gt;
{&lt;br /&gt;
    public static void Main()&lt;br /&gt;
    {&lt;br /&gt;
        MainForm MyForm = new MainForm();&lt;br /&gt;
   &lt;br /&gt;
        Application.Run(MyForm);&lt;br /&gt;
    }&lt;br /&gt;
   &lt;br /&gt;
    public MainForm()&lt;br /&gt;
    {&lt;br /&gt;
        Button MyButton = new Button();&lt;br /&gt;
        &lt;br /&gt;
        Text = &amp;quot;Button Test&amp;quot;;&lt;br /&gt;
        MyButton.Location = new Point(25, 25);&lt;br /&gt;
        MyButton.Text = &amp;quot;Click Me&amp;quot;;&lt;br /&gt;
        MyButton.Click += new EventHandler(MyButtonClicked);&lt;br /&gt;
        Controls.Add(MyButton);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public void MyButtonClicked(object sender, EventArgs Arguments)&lt;br /&gt;
    {&lt;br /&gt;
        MessageBox.Show(&amp;quot;The button has been clicked.&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Build Form without by hand==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;  &lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
class FormHand : Form&lt;br /&gt;
{&lt;br /&gt;
  private TextBox firstNameBox = new TextBox(); &lt;br /&gt;
  private Button btnShowControls = new Button();&lt;br /&gt;
  &lt;br /&gt;
  public FormHand()&lt;br /&gt;
  {&lt;br /&gt;
    firstNameBox.Text = &amp;quot;Text&amp;quot;;&lt;br /&gt;
    firstNameBox.Size = new Size(150, 50);&lt;br /&gt;
    firstNameBox.Location = new Point(10, 10);&lt;br /&gt;
    this.Controls.Add(firstNameBox);&lt;br /&gt;
    btnShowControls.Text = &amp;quot;Click Me&amp;quot;;&lt;br /&gt;
    btnShowControls.Size = new Size(90, 90);&lt;br /&gt;
    btnShowControls.Location = new Point(10, 70);&lt;br /&gt;
    btnShowControls.Click += new EventHandler(btnShowControls_Clicked);&lt;br /&gt;
    this.Controls.Add(btnShowControls);&lt;br /&gt;
    CenterToScreen();&lt;br /&gt;
  }&lt;br /&gt;
  protected void btnShowControls_Clicked(object sender, EventArgs e)&lt;br /&gt;
  {&lt;br /&gt;
    Control.ControlCollection coll = this.Controls;&lt;br /&gt;
    foreach(Control c in coll)&lt;br /&gt;
    {&lt;br /&gt;
      if(c != null)&lt;br /&gt;
        Console.WriteLine(string.Format(&amp;quot;Index: {0}, Text: {1}\n&amp;quot;, coll.GetChildIndex(c, false), c.Text));&lt;br /&gt;
    }&lt;br /&gt;
    MessageBox.Show(&amp;quot;Message&amp;quot;, &amp;quot;Index and Text values for each control&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
    public static int Main(string[] args)&lt;br /&gt;
    {&lt;br /&gt;
    Application.Run(new FormHand());&lt;br /&gt;
    return 0;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Call form constructor to create a Form object==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;class NewForm&lt;br /&gt;
{&lt;br /&gt;
     public static void Main()&lt;br /&gt;
     {&lt;br /&gt;
          new System.Windows.Forms.Form();&lt;br /&gt;
     }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cal Show method to display a form==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System.Windows.Forms;&lt;br /&gt;
   &lt;br /&gt;
class ShowForm&lt;br /&gt;
{&lt;br /&gt;
     public static void Main()&lt;br /&gt;
     {&lt;br /&gt;
          Form form = new Form();&lt;br /&gt;
   &lt;br /&gt;
          form.Show();&lt;br /&gt;
     }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Change Form Cursor==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Collections;&lt;br /&gt;
using System.ruponentModel;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
using System.Data;&lt;br /&gt;
public class FormCursorSetting : System.Windows.Forms.Form&lt;br /&gt;
{&lt;br /&gt;
  private System.ruponentModel.Container components = null;&lt;br /&gt;
  public FormCursorSetting()&lt;br /&gt;
  {&lt;br /&gt;
    InitializeComponent();&lt;br /&gt;
    Cursor = Cursors.WaitCursor;&lt;br /&gt;
    this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);&lt;br /&gt;
  }&lt;br /&gt;
  protected override void Dispose( bool disposing )&lt;br /&gt;
  {&lt;br /&gt;
    if( disposing )&lt;br /&gt;
    {&lt;br /&gt;
      if (components != null) &lt;br /&gt;
      {&lt;br /&gt;
        components.Dispose();&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    base.Dispose( disposing );&lt;br /&gt;
  }&lt;br /&gt;
  private void InitializeComponent()&lt;br /&gt;
  {&lt;br /&gt;
    this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);&lt;br /&gt;
    this.ClientSize = new System.Drawing.Size(292, 273);&lt;br /&gt;
    this.Text = &amp;quot;Form1&amp;quot;;&lt;br /&gt;
  }&lt;br /&gt;
  [STAThread]&lt;br /&gt;
  static void Main() &lt;br /&gt;
  {&lt;br /&gt;
    Application.Run(new FormCursorSetting());&lt;br /&gt;
  }&lt;br /&gt;
  private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)&lt;br /&gt;
  {&lt;br /&gt;
    Graphics g = e.Graphics;&lt;br /&gt;
    g.DrawString(&amp;quot;String...&amp;quot;, new Font(&amp;quot;Times New Roman&amp;quot;, 20), new SolidBrush(Color.Black), 40, 10);&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Change Form size in menu action==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System; &lt;br /&gt;
using System.Windows.Forms; &lt;br /&gt;
 &lt;br /&gt;
class FormChangeSize : Form { &lt;br /&gt;
  MainMenu MyMenu; &lt;br /&gt;
 &lt;br /&gt;
  public FormChangeSize() { &lt;br /&gt;
    Text = &amp;quot;Adding a Main Menu&amp;quot;; &lt;br /&gt;
    MyMenu  = new MainMenu(); &lt;br /&gt;
 &lt;br /&gt;
    MenuItem m1 = new MenuItem(&amp;quot;File&amp;quot;); &lt;br /&gt;
    MyMenu.MenuItems.Add(m1); &lt;br /&gt;
 &lt;br /&gt;
    MenuItem m2 = new MenuItem(&amp;quot;Tools&amp;quot;); &lt;br /&gt;
    MyMenu.MenuItems.Add(m2); &lt;br /&gt;
 &lt;br /&gt;
    MenuItem subm1 = new MenuItem(&amp;quot;Open&amp;quot;); &lt;br /&gt;
    m1.MenuItems.Add(subm1); &lt;br /&gt;
 &lt;br /&gt;
    MenuItem subm2 = new MenuItem(&amp;quot;Close&amp;quot;); &lt;br /&gt;
    m1.MenuItems.Add(subm2); &lt;br /&gt;
 &lt;br /&gt;
    MenuItem subm3 = new MenuItem(&amp;quot;Exit&amp;quot;); &lt;br /&gt;
    m1.MenuItems.Add(subm3); &lt;br /&gt;
 &lt;br /&gt;
    MenuItem subm4 = new MenuItem(&amp;quot;Coordinates&amp;quot;); &lt;br /&gt;
    m2.MenuItems.Add(subm4); &lt;br /&gt;
 &lt;br /&gt;
    MenuItem subm5 = new MenuItem(&amp;quot;Change Size&amp;quot;); &lt;br /&gt;
    m2.MenuItems.Add(subm5); &lt;br /&gt;
 &lt;br /&gt;
    MenuItem subm6 = new MenuItem(&amp;quot;Restore&amp;quot;); &lt;br /&gt;
    m2.MenuItems.Add(subm6); &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
    subm4.Click += MMCoordClick; &lt;br /&gt;
    subm5.Click += MMChangeClick; &lt;br /&gt;
    subm6.Click += MMRestoreClick; &lt;br /&gt;
 &lt;br /&gt;
    Menu = MyMenu; &lt;br /&gt;
  }   &lt;br /&gt;
 &lt;br /&gt;
  [STAThread] &lt;br /&gt;
  public static void Main() { &lt;br /&gt;
    FormChangeSize skel = new FormChangeSize(); &lt;br /&gt;
 &lt;br /&gt;
    Application.Run(skel); &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  protected void MMCoordClick(object who, EventArgs e) { &lt;br /&gt;
    Console.WriteLine(&amp;quot;Top:&amp;quot;+Top); &lt;br /&gt;
    Console.WriteLine(&amp;quot;Left:&amp;quot;+Left); &lt;br /&gt;
    Console.WriteLine(&amp;quot;Bottom:&amp;quot;+Bottom); &lt;br /&gt;
    Console.WriteLine(&amp;quot;Right:&amp;quot;+Right); &lt;br /&gt;
    &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  protected void MMChangeClick(object who, EventArgs e) { &lt;br /&gt;
    Width = Height = 200; &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  protected void MMRestoreClick(object who, EventArgs e) { &lt;br /&gt;
    Width = Height = 300; &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Form Dispose==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Collections;&lt;br /&gt;
using System.ruponentModel;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
using System.Data;&lt;br /&gt;
public class FormDispose : System.Windows.Forms.Form&lt;br /&gt;
{&lt;br /&gt;
  private System.ruponentModel.Container components = null;&lt;br /&gt;
  public FormDispose()&lt;br /&gt;
  {&lt;br /&gt;
    InitializeComponent();&lt;br /&gt;
  }&lt;br /&gt;
  protected override void Dispose( bool disposing )&lt;br /&gt;
  {&lt;br /&gt;
    MessageBox.Show(&amp;quot;Disposing this Form&amp;quot;);&lt;br /&gt;
    if( disposing )&lt;br /&gt;
    {&lt;br /&gt;
      if (components != null) &lt;br /&gt;
      {&lt;br /&gt;
        components.Dispose();&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    base.Dispose( disposing );    &lt;br /&gt;
  }&lt;br /&gt;
  private void InitializeComponent()&lt;br /&gt;
  {&lt;br /&gt;
    this.ruponents = new System.ruponentModel.Container();&lt;br /&gt;
    this.Size = new System.Drawing.Size(300,300);&lt;br /&gt;
    this.Text = &amp;quot;Form1&amp;quot;;&lt;br /&gt;
  }&lt;br /&gt;
  [STAThread]&lt;br /&gt;
  static void Main() &lt;br /&gt;
  {&lt;br /&gt;
    Application.Run(new FormDispose());&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Form message filter==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
public class mainForm : System.Windows.Forms.Form&lt;br /&gt;
{&lt;br /&gt;
  private MyMessageFilter msgFliter = new MyMessageFilter();&lt;br /&gt;
  public mainForm()&lt;br /&gt;
  {&lt;br /&gt;
    Application.ApplicationExit += new EventHandler(Form_OnExit);&lt;br /&gt;
    Application.AddMessageFilter(msgFliter);    &lt;br /&gt;
  }&lt;br /&gt;
  [STAThread]&lt;br /&gt;
  static void Main() &lt;br /&gt;
  {&lt;br /&gt;
    Application.Run(new mainForm());&lt;br /&gt;
  }&lt;br /&gt;
  private void Form_OnExit(object sender, EventArgs evArgs) &lt;br /&gt;
  {&lt;br /&gt;
    Application.RemoveMessageFilter(msgFliter);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
public class MyMessageFilter : IMessageFilter &lt;br /&gt;
{&lt;br /&gt;
  public bool PreFilterMessage(ref Message m) &lt;br /&gt;
  {&lt;br /&gt;
    // Intercept the left mouse button down message.&lt;br /&gt;
    if (m.Msg == 513) &lt;br /&gt;
    {&lt;br /&gt;
      Console.WriteLine(&amp;quot;WM_LBUTTONDOWN is: &amp;quot; + m.Msg);&lt;br /&gt;
      return true;&lt;br /&gt;
    }&lt;br /&gt;
    return false;&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Inherited Form==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
public class BaseForm : System.Windows.Forms.Form&lt;br /&gt;
{&lt;br /&gt;
  private Button btnClose;&lt;br /&gt;
  private Button btnApp;&lt;br /&gt;
  protected Label lbl;&lt;br /&gt;
  public BaseForm()&lt;br /&gt;
  {&lt;br /&gt;
    btnClose = new Button();&lt;br /&gt;
    btnClose.Location = new Point(25,100);&lt;br /&gt;
    btnClose.Size = new Size(100,25);&lt;br /&gt;
    btnClose.Text = &amp;quot;&amp;amp;Close&amp;quot;;&lt;br /&gt;
    btnClose.Click += new System.EventHandler(btnClose_Click);&lt;br /&gt;
    btnApp = new Button();&lt;br /&gt;
    btnApp.Location = new Point(200,100);&lt;br /&gt;
    btnApp.Size = new Size(150,25);&lt;br /&gt;
    btnApp.Text = &amp;quot;&amp;amp;Base Application&amp;quot;;&lt;br /&gt;
    btnApp.Click += new System.EventHandler(btnApp_Click);&lt;br /&gt;
    lbl = new Label();&lt;br /&gt;
    lbl.Location = new Point(25,25);&lt;br /&gt;
    lbl.Size = new Size(100,25);&lt;br /&gt;
    lbl.Text = &amp;quot;This label on BaseForm&amp;quot;;&lt;br /&gt;
    Controls.AddRange(new Control[]{lbl, btnClose, btnApp});&lt;br /&gt;
  }&lt;br /&gt;
  static void Main() &lt;br /&gt;
  {&lt;br /&gt;
    Application.Run(new BaseForm());&lt;br /&gt;
  }&lt;br /&gt;
  private void btnClose_Click(object sender, EventArgs e)&lt;br /&gt;
  {&lt;br /&gt;
    Application.Exit();&lt;br /&gt;
  }&lt;br /&gt;
  private void btnApp_Click(object sender, EventArgs e)&lt;br /&gt;
  {&lt;br /&gt;
    MessageBox.Show(&amp;quot;This is the Base application.&amp;quot;);&lt;br /&gt;
    SomeMethod();&lt;br /&gt;
  }&lt;br /&gt;
  protected virtual void SomeMethod()&lt;br /&gt;
  {&lt;br /&gt;
    MessageBox.Show(&amp;quot;This is SomeMethod called from BaseForm.&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
public class InheritedForm : BaseForm&lt;br /&gt;
{&lt;br /&gt;
  private Button btn;&lt;br /&gt;
  public InheritedForm()&lt;br /&gt;
  {&lt;br /&gt;
    btn = new Button();&lt;br /&gt;
    btn.Location = new Point(25,150);&lt;br /&gt;
    btn.Size = new Size(125,25);&lt;br /&gt;
    btn.Text = &amp;quot;C&amp;amp;lose on Inherited&amp;quot;;&lt;br /&gt;
    btn.Click += new System.EventHandler(btn_Click);&lt;br /&gt;
    Controls.Add(btn);&lt;br /&gt;
    lbl.Text = &amp;quot;Now from InheritedForm&amp;quot;;&lt;br /&gt;
    BackColor = Color.LightBlue;&lt;br /&gt;
  }&lt;br /&gt;
  static void Main() &lt;br /&gt;
  {&lt;br /&gt;
    Application.Run(new InheritedForm());&lt;br /&gt;
  }&lt;br /&gt;
  private void btn_Click(object sender, EventArgs e)&lt;br /&gt;
  {&lt;br /&gt;
    Application.Exit();&lt;br /&gt;
  }&lt;br /&gt;
  protected override void SomeMethod()&lt;br /&gt;
  {&lt;br /&gt;
    MessageBox.Show(&amp;quot;This is the overridden SomeMethod called &amp;quot; + &lt;br /&gt;
                    &amp;quot;from InheritedForm.&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Inherit Form With Constructor==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
   &lt;br /&gt;
class InheritWithConstructor: Form&lt;br /&gt;
{&lt;br /&gt;
     public static void Main()&lt;br /&gt;
     {&lt;br /&gt;
          Application.Run(new InheritWithConstructor());&lt;br /&gt;
     }&lt;br /&gt;
     public InheritWithConstructor()&lt;br /&gt;
     {&lt;br /&gt;
          Text = &amp;quot;Inherit with Constructor&amp;quot;;&lt;br /&gt;
          BackColor = Color.White;&lt;br /&gt;
     }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Irregular form==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
using System.Drawing.Drawing2D;&lt;br /&gt;
public class IrregularForm : Form&lt;br /&gt;
{&lt;br /&gt;
    public IrregularForm()&lt;br /&gt;
    {&lt;br /&gt;
        this.cmdClose = new System.Windows.Forms.Button();&lt;br /&gt;
        this.SuspendLayout();&lt;br /&gt;
        this.cmdClose.Location = new System.Drawing.Point(94, 231);&lt;br /&gt;
        this.cmdClose.Size = new System.Drawing.Size(75, 23);&lt;br /&gt;
        this.cmdClose.Text = &amp;quot;Close&amp;quot;;&lt;br /&gt;
        this.cmdClose.UseVisualStyleBackColor = true;&lt;br /&gt;
        this.cmdClose.Click += new System.EventHandler(this.cmdClose_Click);&lt;br /&gt;
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);&lt;br /&gt;
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;&lt;br /&gt;
        this.ClientSize = new System.Drawing.Size(295, 270);&lt;br /&gt;
        this.Controls.Add(this.cmdClose);&lt;br /&gt;
        this.Text = &amp;quot;Irregular Form&amp;quot;;&lt;br /&gt;
        this.Load += new System.EventHandler(this.IrregularForm_Load);&lt;br /&gt;
        this.ResumeLayout(false);&lt;br /&gt;
    }&lt;br /&gt;
    private void IrregularForm_Load(object sender, EventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
        GraphicsPath path = new GraphicsPath();&lt;br /&gt;
        Point[] pointsA = new Point[]{new Point(0, 0),new Point(40, 60), new Point(this.Width - 100, 10)};&lt;br /&gt;
        path.AddCurve(pointsA);&lt;br /&gt;
        Point[] pointsB = new Point[]{&lt;br /&gt;
                new Point(this.Width - 40, this.Height - 60), &lt;br /&gt;
                new Point(this.Width, this.Height),&lt;br /&gt;
                new Point(10, this.Height)&lt;br /&gt;
            };&lt;br /&gt;
        path.AddCurve(pointsB);&lt;br /&gt;
        path.CloseAllFigures();&lt;br /&gt;
        this.Region = new Region(path);&lt;br /&gt;
    }&lt;br /&gt;
    private void cmdClose_Click(object sender, EventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
        this.Close();&lt;br /&gt;
    }&lt;br /&gt;
    private System.Windows.Forms.Button cmdClose;&lt;br /&gt;
    &lt;br /&gt;
    [STAThread]&lt;br /&gt;
    static void Main()&lt;br /&gt;
    {&lt;br /&gt;
        Application.EnableVisualStyles();&lt;br /&gt;
        Application.SetCompatibleTextRenderingDefault(false);&lt;br /&gt;
        Application.Run(new IrregularForm());&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Move a Form in code==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
public class FormMoveDemo : Form&lt;br /&gt;
{&lt;br /&gt;
    private bool dragging;&lt;br /&gt;
    private Point pointClicked;&lt;br /&gt;
    public FormMoveDemo()&lt;br /&gt;
    {&lt;br /&gt;
        InitializeComponent();&lt;br /&gt;
    }&lt;br /&gt;
    private void lblDrag_MouseDown(object sender, MouseEventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
        if (e.Button == MouseButtons.Left)&lt;br /&gt;
        {&lt;br /&gt;
            dragging = true;&lt;br /&gt;
            pointClicked = new Point(e.X, e.Y);&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            dragging = false;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    private void lblDrag_MouseMove(object sender, MouseEventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
        if (dragging){&lt;br /&gt;
            Point pointMoveTo;&lt;br /&gt;
            pointMoveTo = this.PointToScreen(new Point(e.X, e.Y));&lt;br /&gt;
            pointMoveTo.Offset(-pointClicked.X, -pointClicked.Y);&lt;br /&gt;
            this.Location = pointMoveTo;&lt;br /&gt;
        }   &lt;br /&gt;
    }&lt;br /&gt;
    private void lblDrag_MouseUp(object sender, MouseEventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
        dragging = false;&lt;br /&gt;
    }&lt;br /&gt;
    private void cmdClose_Click(object sender, EventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
        this.Close();&lt;br /&gt;
    }&lt;br /&gt;
    [STAThread]&lt;br /&gt;
    public static void Main(string[] args)&lt;br /&gt;
    {&lt;br /&gt;
        Application.Run(new FormMoveDemo());&lt;br /&gt;
    }&lt;br /&gt;
    private System.Windows.Forms.Button cmdClose= new System.Windows.Forms.Button();&lt;br /&gt;
    private System.Windows.Forms.Label lblDrag = new System.Windows.Forms.Label();&lt;br /&gt;
    private System.ruponentModel.IContainer components = null;&lt;br /&gt;
    private void InitializeComponent()&lt;br /&gt;
    {&lt;br /&gt;
        this.SuspendLayout();&lt;br /&gt;
        // &lt;br /&gt;
        // cmdClose&lt;br /&gt;
        // &lt;br /&gt;
        this.cmdClose.Location = new System.Drawing.Point(102, 215);&lt;br /&gt;
        this.cmdClose.Name = &amp;quot;cmdClose&amp;quot;;&lt;br /&gt;
        this.cmdClose.Size = new System.Drawing.Size(76, 20);&lt;br /&gt;
        this.cmdClose.TabIndex = 5;&lt;br /&gt;
        this.cmdClose.Text = &amp;quot;Close&amp;quot;;&lt;br /&gt;
        this.cmdClose.Click += new System.EventHandler(this.cmdClose_Click);&lt;br /&gt;
        // &lt;br /&gt;
        // lblDrag&lt;br /&gt;
        // &lt;br /&gt;
        this.lblDrag.BackColor = System.Drawing.Color.Navy;&lt;br /&gt;
        this.lblDrag.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;&lt;br /&gt;
        this.lblDrag.Font = new System.Drawing.Font(&amp;quot;Tahoma&amp;quot;, 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));&lt;br /&gt;
        this.lblDrag.ForeColor = System.Drawing.Color.White;&lt;br /&gt;
        this.lblDrag.Location = new System.Drawing.Point(94, 167);&lt;br /&gt;
        this.lblDrag.Name = &amp;quot;lblDrag&amp;quot;;&lt;br /&gt;
        this.lblDrag.Size = new System.Drawing.Size(96, 36);&lt;br /&gt;
        this.lblDrag.TabIndex = 4;&lt;br /&gt;
        this.lblDrag.Text = &amp;quot;Click here to move the form!&amp;quot;;&lt;br /&gt;
        this.lblDrag.MouseUp += new System.Windows.Forms.MouseEventHandler(this.lblDrag_MouseUp);&lt;br /&gt;
        this.lblDrag.MouseMove += new System.Windows.Forms.MouseEventHandler(this.lblDrag_MouseMove);&lt;br /&gt;
        this.lblDrag.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lblDrag_MouseDown);&lt;br /&gt;
        // &lt;br /&gt;
        // FormMoveDemo&lt;br /&gt;
        // &lt;br /&gt;
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);&lt;br /&gt;
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;&lt;br /&gt;
        this.ClientSize = new System.Drawing.Size(292, 266);&lt;br /&gt;
        this.ControlBox = false;&lt;br /&gt;
        this.Controls.Add(this.cmdClose);&lt;br /&gt;
        this.Controls.Add(this.lblDrag);&lt;br /&gt;
        this.Font = new System.Drawing.Font(&amp;quot;Tahoma&amp;quot;, 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));&lt;br /&gt;
        this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;&lt;br /&gt;
        this.MaximizeBox = false;&lt;br /&gt;
        this.MinimizeBox = false;&lt;br /&gt;
        this.ResumeLayout(false);&lt;br /&gt;
    }&lt;br /&gt;
   &lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==ResumeLayout and SuspendLayout==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
class MainForm : Form&lt;br /&gt;
{&lt;br /&gt;
    private Label label1;&lt;br /&gt;
    private TextBox textBox1;&lt;br /&gt;
    private Button button1;&lt;br /&gt;
    public MainForm()&lt;br /&gt;
    {&lt;br /&gt;
         this.label1 = new Label();&lt;br /&gt;
         this.textBox1 = new TextBox();&lt;br /&gt;
         this.button1 = new Button();&lt;br /&gt;
         this.SuspendLayout();&lt;br /&gt;
         this.label1.Location = new System.Drawing.Point(16, 36);&lt;br /&gt;
         this.label1.Name = &amp;quot;label1&amp;quot;;&lt;br /&gt;
         this.label1.Size = new System.Drawing.Size(128, 16);&lt;br /&gt;
         this.label1.TabIndex = 0;&lt;br /&gt;
         this.label1.Text = &amp;quot;Please enter your name:&amp;quot;; &lt;br /&gt;
         this.textBox1.Location = new System.Drawing.Point(152, 32);&lt;br /&gt;
         this.textBox1.Name = &amp;quot;textBox1&amp;quot;;&lt;br /&gt;
         this.textBox1.TabIndex = 1;&lt;br /&gt;
         this.textBox1.Text = &amp;quot;&amp;quot;;&lt;br /&gt;
         this.button1.Location = new System.Drawing.Point(109, 80);&lt;br /&gt;
         this.button1.Name = &amp;quot;button1&amp;quot;;&lt;br /&gt;
         this.button1.TabIndex = 2;&lt;br /&gt;
         this.button1.Text = &amp;quot;Enter&amp;quot;;&lt;br /&gt;
         this.button1.Click += new System.EventHandler(this.button1_Click);&lt;br /&gt;
         this.ClientSize = new System.Drawing.Size(292, 126);&lt;br /&gt;
         this.Controls.Add(this.button1);&lt;br /&gt;
         this.Controls.Add(this.textBox1);&lt;br /&gt;
         this.Controls.Add(this.label1);&lt;br /&gt;
         this.Name = &amp;quot;form1&amp;quot;;&lt;br /&gt;
         this.Text = &amp;quot;Visual C#&amp;quot;;&lt;br /&gt;
         this.ResumeLayout(false);&lt;br /&gt;
     }&lt;br /&gt;
     private void button1_Click(object sender, System.EventArgs e)&lt;br /&gt;
     {&lt;br /&gt;
        System.Console.WriteLine(&amp;quot;User entered: &amp;quot; + textBox1.Text);&lt;br /&gt;
        MessageBox.Show(&amp;quot;Welcome, &amp;quot; + textBox1.Text, &amp;quot;Visual C#&amp;quot;);&lt;br /&gt;
     }&lt;br /&gt;
     [STAThread]&lt;br /&gt;
     public static void Main()&lt;br /&gt;
     {&lt;br /&gt;
        Application.EnableVisualStyles();&lt;br /&gt;
        Application.Run(new MainForm());&lt;br /&gt;
     }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Scroll Form==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Collections;&lt;br /&gt;
using System.ruponentModel;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
using System.Data;&lt;br /&gt;
public class ScrollForm : System.Windows.Forms.Form&lt;br /&gt;
{&lt;br /&gt;
  private System.Windows.Forms.Label label1;&lt;br /&gt;
  private System.ruponentModel.Container components = null;&lt;br /&gt;
  public ScrollForm()&lt;br /&gt;
  {&lt;br /&gt;
    InitializeComponent();&lt;br /&gt;
  }&lt;br /&gt;
  protected override void Dispose( bool disposing )&lt;br /&gt;
  {&lt;br /&gt;
    if( disposing )&lt;br /&gt;
    {&lt;br /&gt;
      if (components != null) &lt;br /&gt;
      {&lt;br /&gt;
        components.Dispose();&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    base.Dispose( disposing );&lt;br /&gt;
  }&lt;br /&gt;
  private void InitializeComponent()&lt;br /&gt;
  {&lt;br /&gt;
    this.label1 = new System.Windows.Forms.Label();&lt;br /&gt;
    this.SuspendLayout();&lt;br /&gt;
    this.label1.Font = new System.Drawing.Font(&amp;quot;Microsoft Sans Serif&amp;quot;, 24F);&lt;br /&gt;
    this.label1.Location = new System.Drawing.Point(16, 16);&lt;br /&gt;
    this.label1.Name = &amp;quot;label1&amp;quot;;&lt;br /&gt;
    this.label1.Size = new System.Drawing.Size(376, 224);&lt;br /&gt;
    this.label1.TabIndex = 0;&lt;br /&gt;
    this.label1.Text = &amp;quot;Scrollbars of course!&amp;quot;;&lt;br /&gt;
    this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);&lt;br /&gt;
    this.AutoScroll = true;&lt;br /&gt;
    this.AutoScrollMinSize = new System.Drawing.Size(300, 300);&lt;br /&gt;
    this.ClientSize = new System.Drawing.Size(319, 136);&lt;br /&gt;
    this.Controls.Add(this.label1);&lt;br /&gt;
    this.Name = &amp;quot;ScrollForm&amp;quot;;&lt;br /&gt;
    this.Text = &amp;quot;ScrollForm&amp;quot;;&lt;br /&gt;
    this.ResumeLayout(false);&lt;br /&gt;
  }&lt;br /&gt;
  [STAThread]&lt;br /&gt;
  static void Main() &lt;br /&gt;
  {&lt;br /&gt;
    Application.Run(new ScrollForm());&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set Form Visible properties==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System.Windows.Forms;&lt;br /&gt;
   &lt;br /&gt;
class RunFormBadly&lt;br /&gt;
{&lt;br /&gt;
     public static void Main()&lt;br /&gt;
     {&lt;br /&gt;
          Form form = new Form();&lt;br /&gt;
   &lt;br /&gt;
          form.Text = &amp;quot;Not a Good Idea...&amp;quot;;&lt;br /&gt;
          form.Visible = true;&lt;br /&gt;
   &lt;br /&gt;
          Application.Run();&lt;br /&gt;
     }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Subclass Form==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
   &lt;br /&gt;
class InheritTheForm: Form&lt;br /&gt;
{&lt;br /&gt;
     public static void Main()&lt;br /&gt;
     {&lt;br /&gt;
          InheritTheForm form = new InheritTheForm();&lt;br /&gt;
          form.Text = &amp;quot;Inherit the Form&amp;quot;;&lt;br /&gt;
          form.BackColor = Color.White;&lt;br /&gt;
   &lt;br /&gt;
          Application.Run(form);&lt;br /&gt;
     }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Text as the title==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System.Threading;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
   &lt;br /&gt;
class ShowFormAndSleep&lt;br /&gt;
{&lt;br /&gt;
     public static void Main()&lt;br /&gt;
     {&lt;br /&gt;
          Form form = new Form();&lt;br /&gt;
   &lt;br /&gt;
          form.Show();&lt;br /&gt;
   &lt;br /&gt;
          Thread.Sleep(2500);&lt;br /&gt;
   &lt;br /&gt;
          form.Text = &amp;quot;My First Form&amp;quot;;&lt;br /&gt;
   &lt;br /&gt;
          Thread.Sleep(2500);&lt;br /&gt;
     }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The difference between Form.Show and Application.Run()==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System.Windows.Forms;&lt;br /&gt;
   &lt;br /&gt;
class TwoForms&lt;br /&gt;
{&lt;br /&gt;
     public static void Main()&lt;br /&gt;
     {&lt;br /&gt;
          Form form1 = new Form();&lt;br /&gt;
          Form form2 = new Form();&lt;br /&gt;
   &lt;br /&gt;
          form1.Text = &amp;quot;Form passed to Run()&amp;quot;;&lt;br /&gt;
          form2.Text = &amp;quot;Second form&amp;quot;;&lt;br /&gt;
          form2.Show();&lt;br /&gt;
   &lt;br /&gt;
          Application.Run(form1);&lt;br /&gt;
   &lt;br /&gt;
          MessageBox.Show(&amp;quot;Application.Run() has returned control back to Main.&amp;quot;,&amp;quot;TwoForms&amp;quot;);&lt;br /&gt;
     }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Hello, WindowsForms Application==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System.Windows.Forms;&lt;br /&gt;
   &lt;br /&gt;
public class SimpleHelloWorld : Form&lt;br /&gt;
{&lt;br /&gt;
    public static void Main()&lt;br /&gt;
    {&lt;br /&gt;
        Application.Run(new SimpleHelloWorld());&lt;br /&gt;
    }&lt;br /&gt;
   &lt;br /&gt;
    public SimpleHelloWorld()&lt;br /&gt;
    {&lt;br /&gt;
        Text = &amp;quot;Hello, WindowsForms!&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Use Inherited form in a separate Main class==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
   &lt;br /&gt;
class SeparateMain&lt;br /&gt;
{&lt;br /&gt;
     public static void Main()&lt;br /&gt;
     {&lt;br /&gt;
          Application.Run(new AnotherHelloWorld());&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
class AnotherHelloWorld: Form&lt;br /&gt;
{&lt;br /&gt;
     public AnotherHelloWorld()&lt;br /&gt;
     {&lt;br /&gt;
          Text = &amp;quot;Another Hello World&amp;quot;;&lt;br /&gt;
          BackColor = Color.White;&lt;br /&gt;
     }&lt;br /&gt;
     protected override void OnPaint(PaintEventArgs pea)&lt;br /&gt;
     {&lt;br /&gt;
          Graphics graphics = pea.Graphics;&lt;br /&gt;
   &lt;br /&gt;
          graphics.DrawString(&amp;quot;Hello, Windows Forms!&amp;quot;, Font,&lt;br /&gt;
                          Brushes.Black, 0, 0);&lt;br /&gt;
     }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>