<?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%2FC_Sharp%2FGUI_Windows_Form%2FForm_Event</id>
		<title>Csharp/C Sharp/GUI Windows Form/Form Event - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FC_Sharp%2FGUI_Windows_Form%2FForm_Event"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/GUI_Windows_Form/Form_Event&amp;action=history"/>
		<updated>2026-04-29T16:41:36Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/C_Sharp/GUI_Windows_Form/Form_Event&amp;diff=18&amp;oldid=prev</id>
		<title> в 15:31, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/GUI_Windows_Form/Form_Event&amp;diff=18&amp;oldid=prev"/>
				<updated>2010-05-26T15:31:18Z</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/C_Sharp/GUI_Windows_Form/Form_Event&amp;diff=19&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/GUI_Windows_Form/Form_Event&amp;diff=19&amp;oldid=prev"/>
				<updated>2010-05-26T11:32:33Z</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;==Bind key action to a form window==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&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 KeyReader : System.Windows.Forms.Form {&lt;br /&gt;
    private System.Windows.Forms.Label lblPress;&lt;br /&gt;
    private System.Windows.Forms.Label lblDown;&lt;br /&gt;
    private System.Windows.Forms.Label label1;&lt;br /&gt;
    public KeyReader() {&lt;br /&gt;
       InitializeComponent();&lt;br /&gt;
    }&lt;br /&gt;
     private void InitializeComponent() {&lt;br /&gt;
      this.lblPress = new System.Windows.Forms.Label();&lt;br /&gt;
      this.lblDown = new System.Windows.Forms.Label();&lt;br /&gt;
      this.label1 = new System.Windows.Forms.Label();&lt;br /&gt;
      this.SuspendLayout();&lt;br /&gt;
      this.lblPress.Font = new System.Drawing.Font(&amp;quot;Microsoft Sans Serif&amp;quot;, 30F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));&lt;br /&gt;
      this.lblPress.Location = new System.Drawing.Point(8, 190);&lt;br /&gt;
      this.lblPress.Name = &amp;quot;lblPress&amp;quot;;&lt;br /&gt;
      this.lblPress.Size = new System.Drawing.Size(408, 48);&lt;br /&gt;
      this.lblPress.TabIndex = 0;&lt;br /&gt;
      this.lblPress.Text = &amp;quot;Press:&amp;quot;;&lt;br /&gt;
      this.lblPress.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;&lt;br /&gt;
      this.lblDown.Font = new System.Drawing.Font(&amp;quot;Microsoft Sans Serif&amp;quot;, 30F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));&lt;br /&gt;
      this.lblDown.Location = new System.Drawing.Point(8, 254);&lt;br /&gt;
      this.lblDown.Name = &amp;quot;lblDown&amp;quot;;&lt;br /&gt;
      this.lblDown.Size = new System.Drawing.Size(408, 48);&lt;br /&gt;
      this.lblDown.TabIndex = 0;&lt;br /&gt;
      this.lblDown.Text = &amp;quot;Down:&amp;quot;;&lt;br /&gt;
      this.lblDown.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;&lt;br /&gt;
&lt;br /&gt;
      this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);&lt;br /&gt;
      this.ClientSize = new System.Drawing.Size(424, 365);&lt;br /&gt;
      this.Controls.AddRange(new System.Windows.Forms.Control[] {&lt;br /&gt;
                                                                  this.label1,&lt;br /&gt;
                                                                  this.lblDown,&lt;br /&gt;
                                                                  this.lblPress});&lt;br /&gt;
      this.KeyPreview = true;&lt;br /&gt;
      this.Name = &amp;quot;KeyReader&amp;quot;;&lt;br /&gt;
      this.Text = &amp;quot;KeyReader&amp;quot;;&lt;br /&gt;
      this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.KeyReader_KeyDown);&lt;br /&gt;
      this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.KeyReader_KeyPress);&lt;br /&gt;
      this.ResumeLayout(false);&lt;br /&gt;
    }&lt;br /&gt;
    [STAThread]&lt;br /&gt;
    static void Main() {&lt;br /&gt;
       Application.Run(new KeyReader());&lt;br /&gt;
    }&lt;br /&gt;
    private void KeyReader_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) {&lt;br /&gt;
      lblPress.Text =  &amp;quot;Press: &amp;quot; + Convert.ToString(e.KeyChar);&lt;br /&gt;
    }&lt;br /&gt;
    private void KeyReader_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) {&lt;br /&gt;
      lblDown.Text = &amp;quot;Down: &amp;quot; + Convert.ToString(e.KeyCode);&lt;br /&gt;
      if (e.KeyCode == Keys.ShiftKey){&lt;br /&gt;
         MessageBox.Show(&amp;quot;That is one shifty character&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
    } &lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Cancel Event==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&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 Form1 : System.Windows.Forms.Form&lt;br /&gt;
  {&lt;br /&gt;
    private Button myButton; &lt;br /&gt;
    public Form1()&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;
        &lt;br /&gt;
            this.Closing+=new CancelEventHandler(Form_Closing);&lt;br /&gt;
      myButton = new Button();&lt;br /&gt;
      myButton.Text = &amp;quot;www.nfex.ru&amp;quot;;&lt;br /&gt;
      myButton.Location = new System.Drawing.Point(64, 32);&lt;br /&gt;
      myButton.Size = new System.Drawing.Size(150, 50);&lt;br /&gt;
 &lt;br /&gt;
      Controls.Add(myButton);&lt;br /&gt;
    }&lt;br /&gt;
        public void Form_Closing(object sender,CancelEventArgs cArgs) {&lt;br /&gt;
            cArgs.Cancel=true; &lt;br /&gt;
        }&lt;br /&gt;
    static void Main() &lt;br /&gt;
    {&lt;br /&gt;
      Application.Run(new Form1());&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Form Focus event==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&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 FocusForm : System.Windows.Forms.Form {&lt;br /&gt;
    private System.Windows.Forms.TextBox txtFocusForm;&lt;br /&gt;
    private System.Windows.Forms.Button btFocusForm;&lt;br /&gt;
    public FocusForm() {&lt;br /&gt;
        this.txtFocusForm = new System.Windows.Forms.TextBox();&lt;br /&gt;
        this.btFocusForm = new System.Windows.Forms.Button();&lt;br /&gt;
        this.SuspendLayout();&lt;br /&gt;
        this.txtFocusForm.Location = new System.Drawing.Point(8, 8);&lt;br /&gt;
        this.txtFocusForm.Size = new System.Drawing.Size(336, 20);&lt;br /&gt;
        this.txtFocusForm.LostFocus += new System.EventHandler(this.txtFocusForm_LostFocus);&lt;br /&gt;
        this.txtFocusForm.GotFocus += new System.EventHandler(this.txtFocusForm_GotFocus);&lt;br /&gt;
        this.btFocusForm.Location = new System.Drawing.Point(8, 40);&lt;br /&gt;
        this.btFocusForm.Size = new System.Drawing.Size(336, 23);&lt;br /&gt;
        this.btFocusForm.Click += new System.EventHandler(this.btFocusForm_Click);&lt;br /&gt;
        this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);&lt;br /&gt;
        this.ClientSize = new System.Drawing.Size(352, 70);&lt;br /&gt;
        this.Controls.AddRange(new System.Windows.Forms.Control[] {&lt;br /&gt;
                                      this.btFocusForm,&lt;br /&gt;
                                      this.txtFocusForm});&lt;br /&gt;
        this.ResumeLayout(false);&lt;br /&gt;
    }&lt;br /&gt;
    [STAThread]&lt;br /&gt;
    static void Main() {&lt;br /&gt;
        Application.Run(new FocusForm());&lt;br /&gt;
    }&lt;br /&gt;
    protected void txtFocusForm_LostFocus(object sender, EventArgs e) {&lt;br /&gt;
        Console.WriteLine(&amp;quot;Goodbye!&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    protected void txtFocusForm_GotFocus(object sender, EventArgs e) {&lt;br /&gt;
        Console.WriteLine(&amp;quot;Hello!&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    private void btFocusForm_Click(object sender, System.EventArgs e) {&lt;br /&gt;
        bool canFocus = txtFocusForm.CanFocus;&lt;br /&gt;
        bool containsFocus = this.ContainsFocus;&lt;br /&gt;
        bool focused = txtFocusForm.Focused;&lt;br /&gt;
        Console.WriteLine(&amp;quot;Textbox can focus: &amp;quot; + canFocus +&lt;br /&gt;
                     &amp;quot;\nForm children contain focus: &amp;quot; + containsFocus +&lt;br /&gt;
                     &amp;quot;\nTextbox has focus: &amp;quot; + focused);&lt;br /&gt;
        txtFocusForm.Focus();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Form Key Press action==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&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;
using System.Drawing.Drawing2D;&lt;br /&gt;
public class Form1 : System.Windows.Forms.Form{&lt;br /&gt;
   public Form1() {&lt;br /&gt;
      InitializeComponent();&lt;br /&gt;
   }&lt;br /&gt;
   private void InitializeComponent() {&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.Name = &amp;quot;Form1&amp;quot;;&lt;br /&gt;
      this.Text = &amp;quot;Form1&amp;quot;;&lt;br /&gt;
      this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.Form1_KeyPress);&lt;br /&gt;
   }&lt;br /&gt;
   static void Main() {&lt;br /&gt;
      Application.Run(new Form1());&lt;br /&gt;
   }&lt;br /&gt;
   private void Form1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) {&lt;br /&gt;
      Console.WriteLine(&amp;quot;Key Press&amp;quot;);&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Form Mouse down action==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&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;
using System.Drawing.Drawing2D;&lt;br /&gt;
public class Form1 : System.Windows.Forms.Form{&lt;br /&gt;
   public Form1() {&lt;br /&gt;
      InitializeComponent();&lt;br /&gt;
   }&lt;br /&gt;
   private void InitializeComponent() {&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.Name = &amp;quot;Form1&amp;quot;;&lt;br /&gt;
      this.Text = &amp;quot;Form1&amp;quot;;&lt;br /&gt;
      this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown);&lt;br /&gt;
   }&lt;br /&gt;
   static void Main() {&lt;br /&gt;
      Application.Run(new Form1());&lt;br /&gt;
   }&lt;br /&gt;
   private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) {&lt;br /&gt;
      Console.WriteLine(&amp;quot;Mouse down&amp;quot;);&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Form OnMove event==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
&lt;br /&gt;
using System;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
   &lt;br /&gt;
class FormSize: Form&lt;br /&gt;
{&lt;br /&gt;
     public static void Main()&lt;br /&gt;
     {&lt;br /&gt;
          Application.Run(new FormSize());&lt;br /&gt;
     }&lt;br /&gt;
     public FormSize()&lt;br /&gt;
     {&lt;br /&gt;
          Text = &amp;quot;Form Size&amp;quot;;&lt;br /&gt;
          BackColor = Color.White;&lt;br /&gt;
     }&lt;br /&gt;
     protected override void OnMove(EventArgs ea)&lt;br /&gt;
     {&lt;br /&gt;
          Invalidate();&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;
          string   str  = &amp;quot;Location: &amp;quot;        + Location        + &amp;quot;\n&amp;quot;   +&lt;br /&gt;
                          &amp;quot;ClientRectangle: &amp;quot; + ClientRectangle;&lt;br /&gt;
   &lt;br /&gt;
          graphics.DrawString(str, Font, Brushes.Black, 0, 0);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Form OnResize==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
&lt;br /&gt;
using System;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
   &lt;br /&gt;
class FormSize: Form&lt;br /&gt;
{&lt;br /&gt;
     public static void Main()&lt;br /&gt;
     {&lt;br /&gt;
          Application.Run(new FormSize());&lt;br /&gt;
     }&lt;br /&gt;
     public FormSize()&lt;br /&gt;
     {&lt;br /&gt;
          BackColor = Color.White;&lt;br /&gt;
     }&lt;br /&gt;
     protected override void OnResize(EventArgs ea)&lt;br /&gt;
     {&lt;br /&gt;
          Invalidate();&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;
          string   str  = &amp;quot;Location: &amp;quot;        + Location        + &amp;quot;\n&amp;quot;   +&lt;br /&gt;
                          &amp;quot;ClientRectangle: &amp;quot; + ClientRectangle;&lt;br /&gt;
   &lt;br /&gt;
          graphics.DrawString(str, Font, Brushes.Black, 0, 0);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Form Paint event==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using System;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
   &lt;br /&gt;
class PaintEvent&lt;br /&gt;
{&lt;br /&gt;
     public static void Main()&lt;br /&gt;
     {&lt;br /&gt;
          Form form   = new Form();&lt;br /&gt;
          form.Text   = &amp;quot;Paint Event&amp;quot;;&lt;br /&gt;
          form.Paint += new PaintEventHandler(MyPaintHandler);&lt;br /&gt;
   &lt;br /&gt;
          Application.Run(form);&lt;br /&gt;
     }&lt;br /&gt;
     static void MyPaintHandler(object objSender, PaintEventArgs pea)&lt;br /&gt;
     {&lt;br /&gt;
          Graphics graphics = pea.Graphics;&lt;br /&gt;
   &lt;br /&gt;
          graphics.Clear(Color.Chocolate);&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Form resize and redraw==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.ruponentModel;&lt;br /&gt;
using System.Data;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Text;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
public class Form1 : Form&lt;br /&gt;
{&lt;br /&gt;
        private System.Windows.Forms.CheckBox chkResizeRedraw;&lt;br /&gt;
      public Form1() {&lt;br /&gt;
            InitializeComponent();&lt;br /&gt;
            &lt;br /&gt;
      }&lt;br /&gt;
    private void FlawedResizing_Paint(object sender, PaintEventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
            ResizeRedraw = chkResizeRedraw.Checked;&lt;br /&gt;
            Pen pen = new Pen(Color.Red, 1);&lt;br /&gt;
            e.Graphics.DrawEllipse(pen, new Rectangle(new Point(0, 0),&lt;br /&gt;
              this.ClientSize));&lt;br /&gt;
            pen.Dispose();        &lt;br /&gt;
            &lt;br /&gt;
    }&lt;br /&gt;
    private void chkResizeRedraw_CheckedChanged(object sender, EventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
      Invalidate();&lt;br /&gt;
    }&lt;br /&gt;
    private void InitializeComponent()&lt;br /&gt;
    {&lt;br /&gt;
            this.chkResizeRedraw = new System.Windows.Forms.CheckBox();&lt;br /&gt;
            this.SuspendLayout();&lt;br /&gt;
            // &lt;br /&gt;
            // chkResizeRedraw&lt;br /&gt;
            // &lt;br /&gt;
            this.chkResizeRedraw.AutoSize = true;&lt;br /&gt;
            this.chkResizeRedraw.Location = new System.Drawing.Point(102, 104);&lt;br /&gt;
            this.chkResizeRedraw.Name = &amp;quot;chkResizeRedraw&amp;quot;;&lt;br /&gt;
            this.chkResizeRedraw.Size = new System.Drawing.Size(95, 17);&lt;br /&gt;
            this.chkResizeRedraw.TabIndex = 0;&lt;br /&gt;
            this.chkResizeRedraw.Text = &amp;quot;ResizeRedraw&amp;quot;;&lt;br /&gt;
            this.chkResizeRedraw.CheckedChanged += new System.EventHandler(this.chkResizeRedraw_CheckedChanged);&lt;br /&gt;
            // &lt;br /&gt;
            // FlawedResizing&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.Controls.Add(this.chkResizeRedraw);&lt;br /&gt;
            this.Name = &amp;quot;FlawedResizing&amp;quot;;&lt;br /&gt;
            this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;&lt;br /&gt;
            this.Text = &amp;quot;FlawedResizing&amp;quot;;&lt;br /&gt;
            this.Paint += new System.Windows.Forms.PaintEventHandler(this.FlawedResizing_Paint);&lt;br /&gt;
            this.ResumeLayout(false);&lt;br /&gt;
            this.PerformLayout();&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.Run(new Form1());&lt;br /&gt;
      }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Form window closing event==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&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 Form1 : System.Windows.Forms.Form&lt;br /&gt;
  {&lt;br /&gt;
    private Button myButton; &lt;br /&gt;
    public Form1()&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;
        &lt;br /&gt;
            this.Closing+=new CancelEventHandler(Form_Closing);&lt;br /&gt;
&lt;br /&gt;
      myButton = new Button();&lt;br /&gt;
      myButton.Text = &amp;quot;www.nfex.ru&amp;quot;;&lt;br /&gt;
      myButton.Location = new System.Drawing.Point(64, 32);&lt;br /&gt;
      myButton.Size = new System.Drawing.Size(150, 50);&lt;br /&gt;
      Controls.Add(myButton);&lt;br /&gt;
      CenterToScreen();&lt;br /&gt;
    }&lt;br /&gt;
        public void Form_Closing(object sender,CancelEventArgs cArgs) {&lt;br /&gt;
            if(sender==this){&lt;br /&gt;
               MessageBox.Show(&amp;quot;Form Closing Event....&amp;quot;);&lt;br /&gt;
               if(sender!=this) {&lt;br /&gt;
                 cArgs.Cancel=true;  &lt;br /&gt;
               }&lt;br /&gt;
            }   &lt;br /&gt;
        }&lt;br /&gt;
    static void Main() &lt;br /&gt;
    {&lt;br /&gt;
      Application.Run(new Form1());&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Form Window event: closing, closed, load, activated, deactivated==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
using System;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
using System.ruponentModel;&lt;br /&gt;
public class MainWindow : Form {&lt;br /&gt;
    private string lifeTimeInfo;&lt;br /&gt;
    public MainWindow() {&lt;br /&gt;
        this.Closing += new CancelEventHandler(MainForm_Closing);&lt;br /&gt;
        this.Load += new EventHandler(MainForm_Load);&lt;br /&gt;
        this.Closed += new EventHandler(MainForm_Closed);&lt;br /&gt;
        this.Activated += new EventHandler(MainForm_Activated);&lt;br /&gt;
        this.Deactivate += new EventHandler(MainForm_Deactivate);&lt;br /&gt;
    }&lt;br /&gt;
    protected void MainForm_Closing(object sender, CancelEventArgs e) {&lt;br /&gt;
        DialogResult dr = MessageBox.Show(&amp;quot;Do you REALLY want to close this app?&amp;quot;,&lt;br /&gt;
             &amp;quot;Closing event!&amp;quot;, MessageBoxButtons.YesNo);&lt;br /&gt;
        if (dr == DialogResult.No)&lt;br /&gt;
            e.Cancel = true;&lt;br /&gt;
        else&lt;br /&gt;
            e.Cancel = false;&lt;br /&gt;
    }&lt;br /&gt;
    protected void MainForm_Load(object sender, System.EventArgs e) { &lt;br /&gt;
        lifeTimeInfo += &amp;quot;Load event\n&amp;quot;; &lt;br /&gt;
    }&lt;br /&gt;
    protected void MainForm_Activated(object sender, System.EventArgs e) { &lt;br /&gt;
        lifeTimeInfo += &amp;quot;Activate event\n&amp;quot;; &lt;br /&gt;
    }&lt;br /&gt;
    protected void MainForm_Deactivate(object sender, System.EventArgs e) { &lt;br /&gt;
        lifeTimeInfo += &amp;quot;Deactivate event\n&amp;quot;; &lt;br /&gt;
    }&lt;br /&gt;
    protected void MainForm_Closed(object sender, System.EventArgs e) {&lt;br /&gt;
        lifeTimeInfo += &amp;quot;Closed event\n&amp;quot;;&lt;br /&gt;
        MessageBox.Show(lifeTimeInfo);&lt;br /&gt;
    }&lt;br /&gt;
    public static void Main(string[] args) {&lt;br /&gt;
        Application.Run(new MainWindow());&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Form window load event==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&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 Form1 : System.Windows.Forms.Form&lt;br /&gt;
  {&lt;br /&gt;
    private Button myButton; &lt;br /&gt;
    public Form1()&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;
        &lt;br /&gt;
            this.Load+=new EventHandler(Form_Load);&lt;br /&gt;
&lt;br /&gt;
      myButton = new Button();&lt;br /&gt;
      myButton.Text = &amp;quot;www.nfex.ru&amp;quot;;&lt;br /&gt;
      myButton.Location = new System.Drawing.Point(64, 32);&lt;br /&gt;
      myButton.Size = new System.Drawing.Size(150, 50);&lt;br /&gt;
      Controls.Add(myButton);&lt;br /&gt;
      CenterToScreen();&lt;br /&gt;
    }&lt;br /&gt;
        public void Form_Load(object sender,EventArgs eArgs)&lt;br /&gt;
        {&lt;br /&gt;
            MessageBox.Show(&amp;quot;Loading Form.....&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    static void Main() &lt;br /&gt;
    {&lt;br /&gt;
      Application.Run(new Form1());&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==OnClick event==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
using System;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Drawing.Printing;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
   &lt;br /&gt;
class PrintableForm: Form&lt;br /&gt;
{&lt;br /&gt;
     public static void Main()&lt;br /&gt;
     {&lt;br /&gt;
          Application.Run(new PrintableForm());&lt;br /&gt;
     }&lt;br /&gt;
     public PrintableForm()&lt;br /&gt;
     {&lt;br /&gt;
          ResizeRedraw = true;&lt;br /&gt;
     }&lt;br /&gt;
     protected override void OnPaint(PaintEventArgs pea)&lt;br /&gt;
     {&lt;br /&gt;
          DoPage(pea.Graphics, ForeColor,ClientSize.Width, ClientSize.Height);&lt;br /&gt;
     }&lt;br /&gt;
     protected override void OnClick(EventArgs ea)&lt;br /&gt;
     {&lt;br /&gt;
          PrintDocument prndoc = new PrintDocument();&lt;br /&gt;
   &lt;br /&gt;
          prndoc.DocumentName = Text;&lt;br /&gt;
          prndoc.PrintPage += new PrintPageEventHandler(PrintDocumentOnPrintPage);&lt;br /&gt;
          prndoc.Print();&lt;br /&gt;
     }&lt;br /&gt;
     void PrintDocumentOnPrintPage(object obj, PrintPageEventArgs ppea)&lt;br /&gt;
     {&lt;br /&gt;
          Graphics grfx  = ppea.Graphics;&lt;br /&gt;
          SizeF    sizef = grfx.VisibleClipBounds.Size;&lt;br /&gt;
   &lt;br /&gt;
          DoPage(grfx, Color.Black, (int)sizef.Width, (int)sizef.Height);&lt;br /&gt;
     }&lt;br /&gt;
     protected virtual void DoPage(Graphics grfx, Color clr, int cx, int cy)&lt;br /&gt;
     {&lt;br /&gt;
          Pen pen = new Pen(clr);&lt;br /&gt;
   &lt;br /&gt;
          grfx.DrawLine(pen, 0,      0, cx - 1, cy - 1);&lt;br /&gt;
          grfx.DrawLine(pen, cx - 1, 0, 0,      cy - 1);&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==OnInputLanguageChanged==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&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 InternationalText : System.Windows.Forms.Form {&lt;br /&gt;
    internal System.Windows.Forms.Label lblInternationalText;&lt;br /&gt;
    internal System.Windows.Forms.Label lblCharCode;&lt;br /&gt;
    private System.Windows.Forms.TextBox textBox1;&lt;br /&gt;
    public InternationalText() {&lt;br /&gt;
        this.lblInternationalText = new System.Windows.Forms.Label();&lt;br /&gt;
        this.lblCharCode = new System.Windows.Forms.Label();&lt;br /&gt;
        this.textBox1 = new System.Windows.Forms.TextBox();&lt;br /&gt;
        this.SuspendLayout();&lt;br /&gt;
        this.lblInternationalText.Location = new System.Drawing.Point(8, 64);&lt;br /&gt;
        this.lblInternationalText.Size = new System.Drawing.Size(288, 23);&lt;br /&gt;
        this.lblCharCode.Location = new System.Drawing.Point(8, 96);&lt;br /&gt;
        this.lblCharCode.Size = new System.Drawing.Size(88, 23);&lt;br /&gt;
        this.textBox1.Location = new System.Drawing.Point(8, 24);&lt;br /&gt;
        this.textBox1.Size = new System.Drawing.Size(288, 20);&lt;br /&gt;
        this.textBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress);&lt;br /&gt;
        this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);&lt;br /&gt;
        this.ClientSize = new System.Drawing.Size(304, 134);&lt;br /&gt;
        this.Controls.AddRange(new System.Windows.Forms.Control[] {&lt;br /&gt;
                                                                      this.textBox1,&lt;br /&gt;
                                                                      this.lblCharCode,&lt;br /&gt;
                                                                      this.lblInternationalText});&lt;br /&gt;
        this.MaximizeBox = false;&lt;br /&gt;
        this.ResumeLayout(false);&lt;br /&gt;
    }&lt;br /&gt;
    [STAThread]&lt;br /&gt;
    static void Main() {&lt;br /&gt;
        Application.Run(new InternationalText());&lt;br /&gt;
    }&lt;br /&gt;
    protected override void OnInputLanguageChanged(InputLanguageChangedEventArgs e) {&lt;br /&gt;
        MessageBox.Show(e.InputLanguage.Culture.Name);&lt;br /&gt;
    }&lt;br /&gt;
    protected override void OnInputLanguageChanging(InputLanguageChangingEventArgs e) {&lt;br /&gt;
        MessageBox.Show(e.InputLanguage.Culture.Name);&lt;br /&gt;
    }&lt;br /&gt;
    private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) {&lt;br /&gt;
        lblInternationalText.Text += e.KeyChar.ToString();&lt;br /&gt;
        lblCharCode.Text = ((int)e.KeyChar).ToString();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==OnKeyDown event==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
&lt;br /&gt;
using System;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
   &lt;br /&gt;
class ExitOnX: Form&lt;br /&gt;
{&lt;br /&gt;
     public static void Main()&lt;br /&gt;
     {&lt;br /&gt;
          Application.Run(new ExitOnX());&lt;br /&gt;
     }&lt;br /&gt;
     public ExitOnX()&lt;br /&gt;
     {&lt;br /&gt;
          Text = &amp;quot;Exit on X&amp;quot;;&lt;br /&gt;
     }&lt;br /&gt;
     protected override void OnKeyDown(KeyEventArgs kea)&lt;br /&gt;
     {&lt;br /&gt;
          if (kea.KeyCode == Keys.X)&lt;br /&gt;
               Close();&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==OnMouseEnter, OnMouseHover, OnMouseLeave event==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
using System;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
   &lt;br /&gt;
class EnterLeave: Form&lt;br /&gt;
{&lt;br /&gt;
     bool bInside = false;&lt;br /&gt;
   &lt;br /&gt;
     public static void Main()&lt;br /&gt;
     {&lt;br /&gt;
          Application.Run(new EnterLeave());&lt;br /&gt;
     }&lt;br /&gt;
     public EnterLeave()&lt;br /&gt;
     {&lt;br /&gt;
     }&lt;br /&gt;
     protected override void OnMouseEnter(EventArgs ea)&lt;br /&gt;
     {&lt;br /&gt;
          bInside = true;&lt;br /&gt;
          Invalidate();&lt;br /&gt;
     }&lt;br /&gt;
     protected override void OnMouseLeave(EventArgs ea)&lt;br /&gt;
     {&lt;br /&gt;
          bInside = false;&lt;br /&gt;
          Invalidate();&lt;br /&gt;
     }&lt;br /&gt;
     protected override void OnMouseHover(EventArgs ea)&lt;br /&gt;
     {&lt;br /&gt;
          Graphics grfx = CreateGraphics();&lt;br /&gt;
    &lt;br /&gt;
          grfx.Clear(Color.Red);&lt;br /&gt;
          System.Threading.Thread.Sleep(500);&lt;br /&gt;
          grfx.Clear(Color.Green);&lt;br /&gt;
          grfx.Dispose();&lt;br /&gt;
     }&lt;br /&gt;
     protected override void OnPaint(PaintEventArgs pea)&lt;br /&gt;
     {&lt;br /&gt;
          Graphics grfx = pea.Graphics;&lt;br /&gt;
   &lt;br /&gt;
          grfx.Clear(bInside ? Color.Green : BackColor);&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==On Mouse Wheel==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
using System;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
   &lt;br /&gt;
class PoePoem: Form&lt;br /&gt;
{&lt;br /&gt;
     public static void Main()&lt;br /&gt;
     {&lt;br /&gt;
          if (!SystemInformation.MouseWheelPresent)&lt;br /&gt;
          {&lt;br /&gt;
               Console.WriteLine(&amp;quot;Program needs a mouse with a mouse wheel!&amp;quot;);&lt;br /&gt;
               return;&lt;br /&gt;
          }&lt;br /&gt;
          Application.Run(new PoePoem());&lt;br /&gt;
     }&lt;br /&gt;
     public PoePoem()&lt;br /&gt;
     {&lt;br /&gt;
     }&lt;br /&gt;
     protected override void OnMouseWheel(MouseEventArgs mea)&lt;br /&gt;
     {&lt;br /&gt;
          Console.WriteLine(mea.Delta);&lt;br /&gt;
   &lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Scrolling (AutoScrollMinSize)==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
&lt;br /&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 Form1 : System.Windows.Forms.Form {&lt;br /&gt;
    [STAThread]&lt;br /&gt;
    static void Main() {&lt;br /&gt;
        Application.Run(new Form1());&lt;br /&gt;
    }&lt;br /&gt;
    protected override void OnPaint(PaintEventArgs e) {&lt;br /&gt;
        Graphics g;&lt;br /&gt;
        g = Graphics.FromHwnd(this.Handle);&lt;br /&gt;
        GraphicsUnit units = GraphicsUnit.Pixel;&lt;br /&gt;
        string path = &amp;quot;your.jpg&amp;quot;;&lt;br /&gt;
        Image im = Image.FromFile(path);&lt;br /&gt;
        this.AutoScrollMinSize = new Size(im.Width, im.Height);&lt;br /&gt;
        //this.AutoScroll = true;&lt;br /&gt;
        Point P = this.AutoScrollPosition;&lt;br /&gt;
        Rectangle dstR = this.ClientRectangle;&lt;br /&gt;
        RectangleF srcR = new RectangleF(-P.X, -P.Y, dstR.Width, dstR.Height);&lt;br /&gt;
        g.DrawImage(im, dstR, srcR, units);&lt;br /&gt;
        g.Dispose();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Scroll Shapes==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.ruponentModel;&lt;br /&gt;
using System.Data;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
&lt;br /&gt;
using System.Text;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
public class Form1 : Form {&lt;br /&gt;
    private Point rectangleTopLeft = new Point(0, 0);&lt;br /&gt;
    private Size rectangleSize = new Size(200, 200);&lt;br /&gt;
    private Point ellipseTopLeft = new Point(50, 200);&lt;br /&gt;
    private Size ellipseSize = new Size(200, 150);&lt;br /&gt;
    private Pen bluePen = new Pen(Color.Blue, 3);&lt;br /&gt;
    private Pen redPen = new Pen(Color.Red, 2);&lt;br /&gt;
    protected override void OnPaint(PaintEventArgs e) {&lt;br /&gt;
        base.OnPaint(e);&lt;br /&gt;
        Graphics dc = e.Graphics;&lt;br /&gt;
        Size scrollOffset = new Size(this.AutoScrollPosition);&lt;br /&gt;
        if (e.ClipRectangle.Top + scrollOffset.Width &amp;lt; 350 ||&lt;br /&gt;
            e.ClipRectangle.Left + scrollOffset.Height &amp;lt; 250) {&lt;br /&gt;
            Rectangle rectangleArea = new Rectangle&lt;br /&gt;
                (rectangleTopLeft + scrollOffset, rectangleSize);&lt;br /&gt;
            Rectangle ellipseArea = new Rectangle&lt;br /&gt;
                (ellipseTopLeft + scrollOffset, ellipseSize);&lt;br /&gt;
            dc.DrawRectangle(bluePen, rectangleArea);&lt;br /&gt;
            dc.DrawEllipse(redPen, ellipseArea);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    public Form1() {&lt;br /&gt;
        this.BackColor = Color.White;&lt;br /&gt;
        this.Size = new System.Drawing.Size(300, 300);&lt;br /&gt;
        this.AutoScrollMinSize = new Size(250, 350);&lt;br /&gt;
    }&lt;br /&gt;
    public static void Main() {&lt;br /&gt;
        Application.Run(new Form1());&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Uncloseable event==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&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 Form1 : System.Windows.Forms.Form&lt;br /&gt;
  {&lt;br /&gt;
    private Button myButton; &lt;br /&gt;
    public Form1()&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;
        &lt;br /&gt;
            this.Closing+=new CancelEventHandler(Form_Closing);&lt;br /&gt;
      myButton = new Button();&lt;br /&gt;
      myButton.Text = &amp;quot;www.nfex.ru&amp;quot;;&lt;br /&gt;
      myButton.Location = new System.Drawing.Point(64, 32);&lt;br /&gt;
      myButton.Size = new System.Drawing.Size(150, 50);&lt;br /&gt;
 &lt;br /&gt;
      Controls.Add(myButton);&lt;br /&gt;
    }&lt;br /&gt;
        public void Form_Closing(object sender,CancelEventArgs cArgs) {&lt;br /&gt;
            cArgs.Cancel=true; &lt;br /&gt;
        }&lt;br /&gt;
    static void Main() &lt;br /&gt;
    {&lt;br /&gt;
      Application.Run(new Form1());&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>