Click here to Skip to main content
16,005,141 members
Home / Discussions / C#
   

C#

 
GeneralRe: removing XML entries Pin
BammBamm17-Aug-05 8:53
BammBamm17-Aug-05 8:53 
GeneralRe: removing XML entries Pin
Mridang Agarwalla17-Aug-05 8:57
Mridang Agarwalla17-Aug-05 8:57 
GeneralRe: removing XML entries Pin
Mridang Agarwalla17-Aug-05 9:00
Mridang Agarwalla17-Aug-05 9:00 
GeneralRe: removing XML entries Pin
Mridang Agarwalla17-Aug-05 9:02
Mridang Agarwalla17-Aug-05 9:02 
GeneralRe: removing XML entries Pin
DavidNohejl17-Aug-05 9:06
DavidNohejl17-Aug-05 9:06 
GeneralRe: removing XML entries Pin
Mridang Agarwalla17-Aug-05 9:10
Mridang Agarwalla17-Aug-05 9:10 
GeneralRe: removing XML entries Pin
BammBamm17-Aug-05 9:22
BammBamm17-Aug-05 9:22 
QuestionIs it possible to grab the entire bitmap for a Windows.Form? Pin
mullala17-Aug-05 7:39
mullala17-Aug-05 7:39 
Hello, I'm trying to grab the entire bitmap for a Windows Form when performing a drag/drop operation, using the code below.

This works fine, except for when part of the form is off-screen or hidden by, say, another window -- in this case the bitmap returned includes part of another window / the Windows Taskbar or whatever is there.

Does anyone know of a way to get the entire bitmap for a Window (i.e. the image that would be shown by that window if it was completely on-screen, topmost and visible). Is there perhaps a native API that can help with this?

Any ideas would be much appreciated, as I'm beginning to think this can't be done.

Andy

[DllImport("gdi32.dll")]
public static extern bool BitBlt(IntPtr hdcDst, int xDst, int yDst, int cx, int cy, IntPtr hdcSrc, int xSrc, int ySrc, uint ulRop);


public Image GetBGImage(System.Windows.Forms.Form formToCopy)
{
Graphics g = Graphics.FromHwnd(formToCopy.Handle);
Bitmap bm = new Bitmap(formToCopy.ClientRectangle.Width, formToCopy.ClientRectangle.Height, g);

Graphics g2 = Graphics.FromImage(bm);

IntPtr hdcScreen = g.GetHdc();
IntPtr hdcBitmap = g2.GetHdc();

BitBlt(hdcBitmap, 0, 0, bm.Width, bm.Height, hdcScreen, 0, 0, 0x00CC0020);

g2.ReleaseHdc(hdcBitmap);
g.ReleaseHdc(hdcScreen);
return bm;
}

GeneralFormat Number String Pin
zaboboa17-Aug-05 7:00
zaboboa17-Aug-05 7:00 
GeneralRe: Format Number String Pin
Steve Maier17-Aug-05 7:22
professionalSteve Maier17-Aug-05 7:22 
GeneralRe: Format Number String Pin
Guffa17-Aug-05 7:36
Guffa17-Aug-05 7:36 
GeneralPrint Multiple pages Pin
Ming Luo17-Aug-05 6:41
Ming Luo17-Aug-05 6:41 
GeneralRe: Print Multiple pages Pin
Mohamad Al Husseiny17-Aug-05 10:02
Mohamad Al Husseiny17-Aug-05 10:02 
GeneralTextBoxes and Numbers Pin
Anonymous17-Aug-05 6:37
Anonymous17-Aug-05 6:37 
GeneralRe: TextBoxes and Numbers Pin
Guffa17-Aug-05 7:51
Guffa17-Aug-05 7:51 
GeneralRe: TextBoxes and Numbers Pin
Anonymous17-Aug-05 8:25
Anonymous17-Aug-05 8:25 
GeneralRe: TextBoxes and Numbers Pin
Anonymous17-Aug-05 8:54
Anonymous17-Aug-05 8:54 
GeneralRe: TextBoxes and Numbers Pin
Anonymous17-Aug-05 9:40
Anonymous17-Aug-05 9:40 
GeneralVery Important Question (Using OOP in nested forms) Pin
moh_monir17-Aug-05 5:28
moh_monir17-Aug-05 5:28 
GeneralRe: Very Important Question (Using OOP in nested forms) Pin
mav.northwind17-Aug-05 7:26
mav.northwind17-Aug-05 7:26 
GeneralRe: Very Important Question (Using OOP in nested forms) Pin
moh_monir17-Aug-05 22:08
moh_monir17-Aug-05 22:08 
GeneralIterate trough windows Pin
Anonymous17-Aug-05 5:18
Anonymous17-Aug-05 5:18 
GeneralRe: Iterate trough windows Pin
Mohamad Al Husseiny17-Aug-05 9:44
Mohamad Al Husseiny17-Aug-05 9:44 
GeneralRe: Iterate trough windows Pin
Anonymous17-Aug-05 11:04
Anonymous17-Aug-05 11:04 
GeneralMDI application problem Pin
Anonymous17-Aug-05 5:16
Anonymous17-Aug-05 5:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.