Drawing to the screen DC with GDI+
-
I'm working on writing a custom menubar/toolbar set of classes, to replace the standard windows menu bar in my applications. I would like to have a fully custom-drawn, pure C#/.NET coded paint method to draw the popup menus for the menubar. I've run into the little problem of needing the screen DC to be able to properly draw the popup menu outside the bounds of the menubar control, though. Is there any way to get the screen DC using GDI+, so I could draw to it as if it were a standard windows control? I remember being able to do this long ago before the days of MFC, but I havn't tried since. I havn't had much luck finding any documentation on how in the MSDN help, nor by browsing around the articles here on CP. Any help is greatly appreciated...
-
I'm working on writing a custom menubar/toolbar set of classes, to replace the standard windows menu bar in my applications. I would like to have a fully custom-drawn, pure C#/.NET coded paint method to draw the popup menus for the menubar. I've run into the little problem of needing the screen DC to be able to properly draw the popup menu outside the bounds of the menubar control, though. Is there any way to get the screen DC using GDI+, so I could draw to it as if it were a standard windows control? I remember being able to do this long ago before the days of MFC, but I havn't tried since. I havn't had much luck finding any documentation on how in the MSDN help, nor by browsing around the articles here on CP. Any help is greatly appreciated...
Try calling GetDC using WIN32 interop. Like this: Step 1. int hdc = GetDC (0) // Gets the screen DC Step 2. Get a graphics object from the DC and draw Step 3. Dispose the graphics object and call releaseDC like this ReleaseDC (hdc, 0) Thanks Shafqat Ahmed admin@shiplu.com
-
Try calling GetDC using WIN32 interop. Like this: Step 1. int hdc = GetDC (0) // Gets the screen DC Step 2. Get a graphics object from the DC and draw Step 3. Dispose the graphics object and call releaseDC like this ReleaseDC (hdc, 0) Thanks Shafqat Ahmed admin@shiplu.com