How to maximize a window in another way

I would like to maximize a window by double-clicking a control inside of it, not only by clicking the maximize button. Also, when window is maximized, another double-click on the control would restore it.
How to do that?
Thanks.
robertutAsked:
Who is Participating?
 
alaplumeConnect With a Mentor Commented:
Just write code behind the control that you want to click on that will change the window state.

me.windowstate=vbmaximized

me.windowstate=vbnormal
0
 
BahnassCommented:
on the double click event of Ur control


Me.WindowState=2    'max


to restore
Me.WindowState=0    'Normal
0
 
raizonCommented:
in your double click event

If Form1.windowstate = vbMaximized Then
  Form1.windowstate = vbNormal
Else
  Form1.windowstate = vbMaximied
End If
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
BahnassCommented:
Yes alaplume  
I'm too late !!
0
 
raizonCommented:
lol me too
0
 
nichiaCommented:
You can access the form that the UserControl is on using the Parent property like this:

Private Sub UserControl_DblClick()
    If (Usercontrol.Parent.Windowstate = vbMaximized) Then
        Usercontrol.Parent.Windowstate = vbNormal
    Else
        Usercontrol.Parent.Windowstate = vbMaximized
    EndIf
End Sub
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.