VB .Net form windowState to keep same

Joined
Sep 4, 2022
Messages
144
Reaction score
16
Hello helpers !

I try to improve a VB .Net software by using a switch between normal/maximized window.

As triggering a scale on Controls is easy and done,
I am stuck when changing from Form1 to Form2 and "keeping current" the windowState ( 0:normal, or 2:maximized ).

It's a logical problem ( hard time this one ) and maybe a mischoice about 'event'.


Code:
Public Sub set_form_scaling()

  'del is the current and active Form

  If del.WindowState = 0 Then ' normal window

     apply_resizing({(1215 / Screen.PrimaryScreen.Bounds.Width), (690 / Screen.PrimaryScreen.Bounds.Height), 12}) ' shrink apply

  End If

  If del.WindowState = 2 Then ' maximized window

     apply_resizing({(Screen.PrimaryScreen.Bounds.Width / 1215), (Screen.PrimaryScreen.Bounds.Height / 690), 18}) ' grow apply

  End If

  If del.WindowState = 1 Then ' minimized window

     ' no action

  End If

End Sub

I have lot of try already , using windowState , using a token about the current form, few events.

About event , which one will be the more relevant to fire this operation on a Form ?
I try with events : Layout / resize / shown... there is always one fork failing
I miss something but can not find the good one.


Thanks in advance ! :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,183
Messages
2,570,966
Members
47,513
Latest member
JeremyLabo

Latest Threads

Top