Drawing on second monitor using Graphics
-
Using the Screen class I can retrieve the DeviceName of my second monitor, which I can feed into CreateDC to get a device context (DC) of that particular monitor. With it I am able to use all kinds of GDI drawing functions, which do show on my second monitor. Although that works, I would rather draw with a C# Graphics object. The problem is that when I make a Graphics object (with Graphics.FromHdc), I get one with the property VisibleClipBounds set to the bounds of the PRIMARY monitor, and this property is read-only! Does anyone know how I could get the VisibleClipBounds to correspond to the bounds of the right monitor (or all monitors)? Thanks.
-
Using the Screen class I can retrieve the DeviceName of my second monitor, which I can feed into CreateDC to get a device context (DC) of that particular monitor. With it I am able to use all kinds of GDI drawing functions, which do show on my second monitor. Although that works, I would rather draw with a C# Graphics object. The problem is that when I make a Graphics object (with Graphics.FromHdc), I get one with the property VisibleClipBounds set to the bounds of the PRIMARY monitor, and this property is read-only! Does anyone know how I could get the VisibleClipBounds to correspond to the bounds of the right monitor (or all monitors)? Thanks.
The Screen class allows you to get the dimensions of the second monitor. You can then create a screen and put it onto the second monitor by giving it those bounds. I'm not sure how you'd go about getting the DC to draw directing to the desktop, however, am I right in thinking that's what you want ?
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
The Screen class allows you to get the dimensions of the second monitor. You can then create a screen and put it onto the second monitor by giving it those bounds. I'm not sure how you'd go about getting the DC to draw directing to the desktop, however, am I right in thinking that's what you want ?
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
Christian Graus wrote:
I'm not sure how you'd go about getting the DC to draw directing to the desktop, however, am I right in thinking that's what you want ?
Actually, I don't want to draw on the desktop but on top of my own application across several separate controls, basically to display a box around an area to draw attention to it. I tried walking through the nested controls on my form, but you can only draw in their client areas, which in some cases doe not cover the entire control (e.g. Edit boxes and list boxes with borderstyle "Fixed3D"). Hence I felt forced to revert to old GDI.