0

This question's solution is what I was looking for here. But the solution on this question only works for one screen. I want to print same drawing on multiple screen. How do i achieve that. Please help me out here.

Thank you

metadata
  • 38
  • 8
  • You will have to draw your picture twice using a DC for each monitor. – keith Nov 20 '17 at 17:22
  • @keith How to i get different monitor. i did this Graphics g = Graphics.FromHwnd(IntPtr.Zero); g.DrawRectangle(p, new Rectangle(Screen.AllScreens[i].Bounds.X, Screen.AllScreens[i].Bounds.Y, Screen.AllScreens[i].Bounds.Width, Screen.AllScreens[i].Bounds.Height)); But this just draws twice on the same screen – metadata Nov 20 '17 at 17:29

1 Answers1

0

The solution linked describes using a Display Context Handle (hdc) to get a drawing area for GDI+. An hdc is typically a windows's drawing area or the primary display. As keith mentioned in the comments, you will need to get an HDC for the 2nd display and draw to that as well.

https://msdn.microsoft.com/en-us/library/dd144947%28v=vs.85%29.aspx

Here is another question that is attempting a similar result in C++. The concepts should be pretty much the same. How to draw over second monitor with GDIPLUS

peewee_RotA
  • 406
  • 4
  • 8
  • This is what I am doing but it is still drawing on the same screen twice. IntPtr WindowDC = GetWindowDC(IntPtr.Zero); using (Graphics grfx = Graphics.FromHdc(WindowDC)) { for (int i = 0; i < Screen.AllScreens.Length; i++) grfx.DrawRectangle(p, new Rectangle(Screen.AllScreens[i].Bounds.X, Screen.AllScreens[i].Bounds.Y, Screen.AllScreens[i].Bounds.Width, Screen.AllScreens[i].Bounds.Height)); ReleaseDC(IntPtr.Zero, WindowDC); } ReleaseDC(IntPtr.Zero, WindowDC); – metadata Nov 20 '17 at 18:36
  • I think you're missing that in order to get more than the primary monitor you have to use EnumDisplayMonitors. That's detailed in both links provided in the answer... Here's more information on how to use EnumDisplayMonitors: https://msdn.microsoft.com/en-us/library/dd162610(v=vs.85).aspx – peewee_RotA Nov 20 '17 at 19:37