General Category > Support Questions

Second monitor

(1/1)

stephen.crouch:
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.

stephen.crouch:
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:
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:
You can try the code below:


--- Code: ---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

--- End code ---

Navigation

[0] Message Index

Go to full version