Author Topic: Second monitor  (Read 3458 times)

stephen.crouch

  • Newbie
  • *
  • Posts: 7
    • View Profile
Second monitor
« on: April 02, 2024, 09:26:00 AM »
Hello, I've got the 17" Industrial panel, and I'm trying to set up a second monitor for a process overview screen.  How do I do that - create the second screen that is.  I have a TV attached as the monitor, but I don't know how to get the second form in VB created.

I have not dealt with VB much at all, and all of my HMI experience is Allen-Bradley PanelView and older PanelMate controls.  This seems to have a steep learning curve, hopefully I'll figure it out before our go-live date, but the lack of documentation is frustrating.
« Last Edit: April 03, 2024, 08:10:09 AM by stephen.crouch »

stephen.crouch

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Second monitor
« Reply #1 on: May 01, 2024, 04:43:47 PM »
I'm guessing it will be something like creating a second MainForm, but I'm not sure how the panel loads the files on boot. Do I just put a second .sln file in the root directory of the thumb drive?  What would I name it?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Second monitor
« Reply #2 on: May 08, 2024, 05:32:14 PM »
It has been a long time since I have done this, but you need to create another form, show it, then dock it onto the second monitor. I would have to search for the code to remember how to dock the form onto the second monitor

bachphi

  • Hero Member
  • *****
  • Posts: 671
    • View Profile
Re: Second monitor
« Reply #3 on: October 03, 2024, 04:30:03 PM »
You can try the code below:

Code: [Select]
Imports System.Windows.Forms

.....

 Private Sub MainForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load



        ' Show the main form on the primary monitor
        Me.StartPosition = FormStartPosition.Manual
        'Me.Location = Screen.PrimaryScreen.Bounds.Location
        Me.Location = Screen.AllScreens(0).Bounds.Location
        Me.Size = New Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)
        Me.Show()

        ' Create and show the second form on the second monitor
        Dim secondForm As New Form()
        Dim screens() As Screen = Screen.AllScreens

        If screens.Length > 1 Then
            ' Assuming the second monitor is at index 1
            Dim secondMonitor As Screen = screens(1)
            Dim bounds As Rectangle = secondMonitor.Bounds

            secondForm.StartPosition = FormStartPosition.Manual
            secondForm.Location = New Point(bounds.X, bounds.Y)
            secondForm.Size = New Size(bounds.Width, bounds.Height)
            secondForm.Show()
        Else
            MessageBox.Show("Only one monitor detected.")
        End If
    End Sub
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================