how to know the size of a form when the user click the maximize button and the form is maximized

Hello everyone,

I would like to know which event to use for knowing the size of the form when the maximized button is pushed and the form is maximized. Event resized is not invoked, and i do not find another event.

Thanks.




Answer this question

how to know the size of a form when the user click the maximize button and the form is maximized

  • MarioMario

    SizeChanged.

    Regards.


  • elkadeem

    the event resize can be fired by

    using System;

    using System.Collections.Generic;

    using System.ComponentModel;

    using System.Data;

    using System.Drawing;

    using System.Text;

    using System.Windows.Forms;

    namespace CS

    {

    public partial class maxsize : Form

    {

    public maxsize()

    {

    InitializeComponent();

    }

    protected override void OnResize(EventArgs e)

    {

    if (WindowState == FormWindowState.Maximized)

    {

    string a=this.Height.ToString();

    string b = this.Width.ToString();

    MessageBox.Show("before max height is "+a+" width is "+b);

    }

    else if (WindowState == FormWindowState.Minimized)

    {

    MessageBox.Show("min");

    }

    }

    }

    }



  • how to know the size of a form when the user click the maximize button and the form is maximized