React to form resize event : Form Event « GUI Windows Forms « C# / CSharp Tutorial






React to form resize event
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

public class ResizeForm : System.Windows.Forms.Form
{
  private System.ComponentModel.Container components;

  public ResizeForm()
  {
    InitializeComponent();
  }

  protected override void Dispose( bool disposing )
  {
    if( disposing )
    {
      if (components != null) 
      {
        components.Dispose();
      }
    }
    base.Dispose( disposing );
  }

  private void InitializeComponent()
  {
    this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
    this.ClientSize = new System.Drawing.Size(292, 273);
    this.Resize += new System.EventHandler(this.ResizeForm_Resize);


  }
  [STAThread]
  static void Main() 
  {
    Application.Run(new ResizeForm());
  }

  private void ResizeForm_Resize(object sender, System.EventArgs e)
  {
    Invalidate();
    Console.WriteLine("Resize");
  }

}








23.3.Form Event
23.3.1.Form size changed event handlerForm size changed event handler
23.3.2.All form eventsAll form events
23.3.3.React to form resize eventReact to form resize event
23.3.4.Paint eventPaint event
23.3.5.Paint two forms with one paint event handler
23.3.6.Paint one forms with two paint event handler
23.3.7.Form Mouse Up event
23.3.8.Form mouse move event
23.3.9.Form Key event
23.3.10.Form life time event: Closing, Load, Closed, Activated, Deactivate
23.3.11.Cancel Form Closing event
23.3.12.Form Paint eventForm Paint event