Hi I utilize the below code to increase the size of all the controls of my form when the form is maximized as anchor , dock and autosize does not icrease size of the control.
Private Sub PaForm_Resize(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles Me.Resize
If Me.WindowState = FormWindowState.Maximized Then
count = count + 1
If count <= 2 Then
Dim RW As Double = (Me.Width - CW) / CW ' Ratio change of width
Dim RH As Double = (Me.Height - CH) / CH ' Ratio change of height
For Each Ctrl As Control In Controls
Ctrl.Width += CInt(Ctrl.Width * RW)
Ctrl.Height += CInt(Ctrl.Height * RH)
Ctrl.Left += CInt(Ctrl.Left * RW)
Ctrl.Top += CInt(Ctrl.Top * RH)
Next
For Each c As Control In Panel1.Controls
c.Width += CInt(c.Width * RW / 4)
c.Height += CInt(c.Height * RH / 4)
c.Left += CInt(c.Left * RW / 4)
c.Top += CInt(c.Top * RH / 4)
Next
End If
End If
When i restore down the size of the controls are same and does not fit in to the window.
can you please suggest how to decrease the size and get all the controls to the normal state.
Form maximized:
After restore:
Expected: