Hello everyone. I have started to make an application to replace 10" PanelView Plus. Using VisualStudio 2017 Community Edition on Windows 10 Enterp.
First try is not to use any code. So, simply follow instructions:
- In Solution Explorer, right click the AdvancedHMI project and select Properties
- Under the application tab change the Startup Form to MainMenu
You will now create new forms. Be sure to set the FormBorderStyle to None for all forms. After creating additional forms and Building the project, you can now add menu buttons for them:
- In Solution Explorer, expand down the AdvancedHMI project, then expand down to FormChangeControls\MainMenuDriven
- Double the MainMenu.vb to open in Design View
- From the Toolbox add a MainMenuButton for each new form
- Set the FormToOpen property
- You can also set the OpenOnStartup property for one button to indicate the default startup form
I did. Made MainMenu as a global menu. Zone1 calls submenu (another form just beside MainForm on layout) and few forms with actual information on the screens called from submenu form. As I understood MainMenuButtons work from MainMenu form only. They don't work on other forms. In my case on other forms these buttons don't see my other forms to call. Forms are visible to call from the MainMenu form only.
Compile, build and run it. It works. However it works in weird way.
Main menu form loads. In properties of button Zone1 (MainMenuButton) I call submenu with the flag OpenOnStartup: True.
OpenOnStartup doesn't work. Only MainMenu form is opens on Startup. Well, I click on Zone1 and submenu form loads beside mainmenu form on the right. Exactly how it supposed to be. Not bad. Now it is time to call 3rd form just beside submenu form on the right.
On SubMenu form I use FormChangeButton. Click on it and form with actual information from PLC is opens just beside submenu form on the right. Good! However my submenu form is not visible and I see a gap between MainMenu form and last open form.
Then I made another information form with the same properties and location as first.
Ok, will go further. I call my second information screen from the second MainManuButton on the MainMenu form. It works. Information form opens, but opens just beside MainMenu, not according to coordinates in the properties. Hm... I call second information screen from another FormChangeButton ot the Submenu form and it opens just beside MainMenu form, not according to position coordinates. So, two my information forms have identical properties in location coordinates but their position on the screen is different.
Even more. On the task bar I see every open form as a separate window, not as one application. How to deal with it? Use MDI ?
It seems like MainMenuButton closes all forms except MainMenu form and then opens form on call. What is the right way to manipulate between forms to keep some of them open (submenu for example)?
Also, I have noticed that there is a small problem with form size/scale. For some reason if form size 150x700 pixels on the screen it can be shown with ~95% scale. All my forms in properties have fixes size in pixels with start position flag: manual. AutoScaleMode value is : Inherit.
Project can be downloaded from Google Drive:
https://drive.google.com/file/d/19Z4MppSJ1mU_UZWTels2f-sY1MkGPVos/view?usp=sharingThanks