Link to home
Start Free TrialLog in
Avatar of emi_sastra
emi_sastra

asked on

Show forms to many monitor.

Hi,

I want to show a form to many monitors.

ie. : We have 5 monitors with 1 for input monitor and 4 for display the inputted data with different format forms.

Monitor 1 : Input data (Form1).
Monitor 2 : Display data (Form2) from Form2.

How should I do to achieve it?

Thank you.
Avatar of Corey Scheich
Corey Scheich
Flag of United States of America image

Something like this should get you close I don't have multiple monitors here so I couldn't test it.  Just have all your forms inherit from base form they will receive the screens in the order they are loaded.

Corey2
Public Class BaseForm
 
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim scrn As Screen
        scrn = ScreenManager.GetOpenScreen(Me)
        ScreenManager.MoveToScreen(Me, scrn)
    End Sub
 
End Class
 
Public Class ScreenManager
 
    Private Shared _UsedScreens As New Hashtable
 
    Public Shared Property UsedScreens() As Hashtable
        Get
            Return _UsedScreens
        End Get
        Set(ByVal value As Hashtable)
            _UsedScreens = value
        End Set
    End Property
 
    Public Shared Function GetOpenScreen(ByVal Form As Windows.Forms.Form) As Screen
        If UsedScreens.Count = 0 Then
            'No screens used set to primary screen
            UsedScreens.Add(Form, Screen.PrimaryScreen)
            Return Screen.PrimaryScreen
        Else
            If UsedScreens.Count = Screen.AllScreens.Count Then
                'all screens have been used use primary
                Return Screen.PrimaryScreen
            Else
                'select next open screen
                For Each s As Screen In Screen.AllScreens
                    If Not ScreenManager.UsedScreens.ContainsValue(s) Then
                        UsedScreens.Add(Form, s)
                        Return s
                    End If
                Next
            End If
 
        End If
        'If by chance we get to here default the primary screen'
        Return Screen.PrimaryScreen
    End Function
 
    Public Shared Sub MoveToScreen(ByVal frm As Windows.Forms.Form, ByVal scrn As Screen)
        frm.DesktopLocation = scrn.WorkingArea.Location
        frm.WindowState = FormWindowState.Maximized
    End Sub
 
 
End Class

Open in new window

Avatar of emi_sastra
emi_sastra

ASKER

Hi Corey2,

Thanks for your comment.

I still don't get it.

Let's say :

Form1 for input :

1. Car Police No.
2. Time needed for service.

Form2 for Display it in big Font.

Now I have those forms already. What should I do with your code?

Thank you.

Avatar of Nasir Razzaq
How do you connect 5 forms to a computer?
Are the forms in an MDI or separate in taskbar?
Hi CodeCruiser,

Only one computer with 6 monitors, one monitor attach to the computer, others is parallels.

The second form is displayed to  5 monitors.

Thank you.
I still do not understand your monitor configuration! You have one monitor attached to the computer and the other 5 monitors are just receiving the same stream? Mean Mirroring the connected computer?
Just using cables to connect it, but not mirroring.
We should be able to choose which monitor to display it.
The parent monitor may not be the same display as the other 5 monitors.

Thank you,
Please the link below to make it familiar.

http://officeone.mvps.org/multi_monitor/multi_monitor_support.html

Thank you.
ASKER CERTIFIED SOLUTION
Avatar of Corey Scheich
Corey Scheich
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Corey2,

I get it now, I haven't tried it yet to multiple monitor. I will try it later.

BTW, could we just show the form to certain monitor, because at the display property settings, we could see the number of the monitor?

Thank you.
are you referring to Scrn.devicename = "\\.\Display1
I don't get it.

Do you mean we just change the base form to point to certain monitor?  

Thank you.
The Screen.AllScreens property lists the screens to get an individual screen you would use it like this

screen.allscreens(0) 'This should be screen 1

screen.allscreens(1) 'This should be screen 2


screen.allscreens(3) 'This should be screen 4

so to put a form on screen 2 you call

ScreenManager.MoveToScreen(Me, screen.allscreens(1))
I get it now.

I will try it tomorrow and be back to you with the result.

Great explanation.

Thank you very much for your help.

Hi Corey2,

I am trying now, but not success yet.
The second like become one big screen.
I could move screen from my computer (monitor) to the second monitor.

What's wrong with it?

Thank you.
My main problem is the form2 is shown at my monitor not the second monitor.

Thank you.
More info.
 
Public Shared Sub MoveToScreen(ByVal frm As Windows.Forms.Form, ByVal scrn As Screen)
        frm.DesktopLocation = scrn.WorkingArea.Location ----------------------------------------------------> X =1280 Y=0
        frm.WindowState = FormWindowState.Maximized
    End Sub

Thank you.
frm.DesktopLocation = scrn.WorkingArea.Location ----------------------------------------------------> X =1280 Y=0

result :

frm.DesktopLocation ---> X=0 Y=0

Why is it?

Thank you.
Make sure your forms are not set to be maximized initially.  I believe you have to change them to normal to move from screen to screen.  I tried the code at work with 2 monitors and it worked well.
I am trying it now.
I will inform you as soon as possible.

Thank you.
Yes, it works now. It cause of the maximized property.

One more question.

 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim scrn As Screen
        scrn = ScreenManager.GetOpenScreen(Me)
        ScreenManager.MoveToScreen(Me, scrn)
    End Sub

Does it mean all of the monitors include attached to CPU monitor display the same form?

Thank you.
No each new form will retrieve a new Monitor(screen) from the GetOpenScreen until they are all used after that the rest get the primary monitor.
I still don't get it. Sorry, I just use two monitor now, my notebook and a monitor, can't test it.

When the form contains inherits BaseForm is called then all the monitors (except the my notebook) will display the form?

Thank you.

Is your windows bar going across both monitors?
Is your windows bar going across both monitors?
No.

When I move my mouse to the right of the screen until off my screen, my mouse is disappeared and appear at the second monitor. It is like a big width monitor.

Thank you.
Could you post a screenshot of the behavior?  I am not fully understanding what is happening.
I mean my notebook screen with the other monitor screen is treated as one screen.

Thank you.
That would likely be due to the way you are enabling dual monitors.  I normally see that when enabling it through the graphics driver instead of using the Windows interface to set it up.
Picture-3.png
Yes, exactly, I use display settings.

No each new form will retrieve a new Monitor(screen) from the GetOpenScreen until they are all used after that the rest get the primary monitor.

How to display to all other of the monitors except my monitor when the form2 is called?

Thank you.
You want form 2 alone to span 4 monitors?  I was under the impression you had a form for each monitor.
-You want form 2 alone to span 4 monitors?  
For the moment, yes.

-I was under the impression you had a form for each monitor.
I also want to do it in the future.
Regarding this, could we use the same form (form2) to display to all of the monitor one by one with different display contain. For example :

Monitor    Display Content.
1.             One
2.             Two
3.             Three.
4.             Four.

Thank you.
Each new instance of Form2 that is created should go to a new monitor untill they are all filled so all you should have to do is like below assuming form1 is already showing

Dim Screen2Form as new Form2
DIm Screen3Form as new Form2
Dim screen4Form as new Form2
Screen2.from.show
screen3.form.show
screen4.form.show

Open in new window

Woops that should be
Dim Screen2Form as new Form2
DIm Screen3Form as new Form2
Dim screen4Form as new Form2
Screen2from.show
screen3form.show
screen4form.show

Open in new window

Yes, I get it.

You want form 2 alone to span 4 monitors?
How to do this? Once the 1st monitor is finished input data and press a button, then the information is displayed to all of the other monitors at once. I can not try it since I just have one extra monitor now.

Thank you.
The last example I gave should put CLONES of Form2 on 3 extra monitors.

Which of the below pictures are you trying to accomplish
Form2-Clones.png
Span-FOrm.png
-Which of the below pictures are you trying to accomplish?
At the moment I need span.

Thank you.



Sorry,

For the picture you gave. The span means 4 monitors become one screen?

Thank you.