Author Topic: Making form size independent using MainMenu  (Read 2470 times)

Automatikai

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Automation Consulting, LLC
Making form size independent using MainMenu
« on: May 22, 2024, 10:41:51 AM »
I have finally figured out how to do my screen navigation using the MainMenu, but can't seem to find where the size is overridden on the sub screens. I want the MainMenu to stay docked as it does, but I'd like the screens to appear at the size they are defined as in the properties of the screen and still remain movable. Somewhere the Main Menu overrides the size and makes the sub screen all the same height as the Main Menu, and full width.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Making form size independent using MainMenu
« Reply #1 on: May 22, 2024, 11:26:11 AM »
If you are using 3.99y, in the MainMenuButton.vb code at line 264 is where it sets the form size to fill the screen less the main menu
Code: [Select]
               If MenuPosition = AdvancedHMI.Controls.MenuPos.LeftOrTop Then
                   If pf.width < pf.height Then
                       '* Menu is on left
                       f1.Size = New Size(System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Width - pf.Width, pf.Height)
                       f1.Location = New Point(pf.width, 0)
                   Else
                       '* Menu on Top
                       f1.Size = New Size(pf.Width, System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Height - pf.Height)
                       f1.Location = New Point(0, pf.height)
                   End If
               Else
                   '* Menu on Right
                   If pf.width < pf.height Then
                       f1.Size = New Size(System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Width - pf.Width, pf.Height)
                       f1.Location = New Point(pf.location.x - f1.Width, 0)
                   Else
                       '* Menu on Bottom
                       f1.Size = New Size(pf.Width, System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Height - pf.Height)
                       f1.Location = New Point(0, pf.location.y - f1.Height)
                   End If
               End If