I am developing a feedback system for an automotive company. On the billing desk, there is a dual monitor setup: one for a billing person and one for a customer who's giving feedback. My need is to duplicate a Windows form on both screens, as mirror images, So that the billing person can see what feedback the customer is giving.
I am using the code below for display on the secondary screen:
Screen[] sc;
Form f = new Form();
sc = Screen.AllScreens;
f.FormBorderStyle = FormBorderStyle.None;
f.Left = sc[1].Bounds.Left;
f.Top = sc[1].Bounds.Top;
f.Height = sc[1].Bounds.Height;
f.Width = sc[1].Bounds.Width;
f.StartPosition = FormStartPosition.Manual;
f.Show();
However, it will not mirror the form on the primary screen. I had also referred to the duplicate window question, but it will create different instances for the same form, which will not mirror the Windows form. How can I mirror it on both screens?
One possible way to do it would be to capture the form that is inputting the data to a image on a timer (use a reasonable delay so that it's "almost realtime") and use it on a PictureBox
on the secondary form. To capture the form to a image you do:
Bitmap bmp = new Bitmap(form.Width, form.Height);
form.DrawToBitmap(bmp, new Rectangle(Point.Empty, bmp.Size));
Then you assign bmp
as the image to the PictureBox
on the other form.
I've made a quick sample project and uploaded it here: https://www.dropbox.com/s/pjuk3zvpbglhodb/SOTestMirror.zip?dl=0
Lacks opening the form on the secondary screen and styling, but shows a possible way to do it
The result is:
For the record: I have no clue why when DrawToBitmap
is called on a form it copies to the bitmap using a Windows 7 chrome instead of the Windows 8 one... that's interesting, to say the least (and I'd say a bug). That's running on Win 8.1. (Since I haven't seen this mentioned anywhere, I've opened a bug on Connect: https://connect.microsoft.com/VisualStudio/feedback/details/1059444/in-windows-8-drawtobitmap-on-a-form-draws-the-windows-7-chrome)