
When this arrow appears, click-and-drag to make the window larger or smaller. To do so, move the cursor to any edge or corner of the window until a double-headed arrow appears. When the upper-right section of the window looks like, your window is now in "resize mode," meaning you can use the mouse cursor to make the window any size you want.

The Layout event is raised in response to a Resize event, but also in response to other changes that affect the layout of the control.įor more information about handling events, see Handling and Raising Events. To handle custom layouts, use the Layout event instead of the Resize event. To determine the Size of the resized control, you can cast the sender parameter of the registered ControlEventHandler method to a Control and get its Size property (or Height and Width properties individually). ' Ensure the Form remains square (Height = Width). Private Sub Form1_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Resize

Private void Form1_Resize(object sender, System.EventArgs e) If ( control->Size.Height != control->Size.Width )Ĭontrol->Size = System::Drawing::Size( control->Size.Width, control->Size.Width )

Ensure the Form remains square (Height = Width). Void Form1_Resize( Object^ sender, System::EventArgs^ /*e*/ ) To run this example, make sure and associate this event-handling method with the form's Resize event. When the form is resized, the event handler ensures that the form stays square (its Height and Width remain equal). The following code example handles the Resize event of a Form. public:Įvent EventHandler ^ Resize public event EventHandler Resize public event EventHandler? Resize member this.Resize : EventHandler Public Custom Event Resize As EventHandler Event Type EventHandler Examples
