Step 1:
Add a reference to the .NET component Microsoft.mshtml
Step 2:
Use an instance of AxWebBrowser to display the web page in the
app
private AxSHDocVw.AxWebBrowser
Step 3:
Set up an event handler for AxWebBrowser.DocumentComplete :
browser.DocumentComplete += new
AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEventHandler(this.DocumentLoaded);
Step 4: Import the GDI32.dll, specifically BitBlit :
[DllImport("GDI32.dll")]
private static extern bool BitBlt(
IntPtr hdcDest, // handle to destination DC
int nXDest, // x-coord of destination upper-left corner
int nYDest, // y-coord of destination upper-left corner
int nWidth, // width of destination rectangle
int nHeight, // height of destination rectangle
IntPtr hdcSrc, // handle to source DC
int nXSrc, // x-coordinate of source upper-left corner
int nYSrc, // y-coordinate of source upper-left corner
System.Int32 dwRop // raster operation code
);
Step 5:
Implement the EventHandler
private void DocumentLoaded(object sender,
AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
{
Graphics g = browser.CreateGraphics();
Image im = new Bitmap(browser.Width, browser.Height, g);
Graphics g2 = Graphics.FromImage(im);
IntPtr dc = g.GetHdc();
IntPtr dc2 = g2.GetHdc();
BitBlt(dc2, 0, 0, this.ClientRectangle.Width,
this.ClientRectangle.Height, dc, 0, 0, 13369376);
g.ReleaseHdc(dc);
g2.ReleaseHdc(dc2);
im.Save(@"C:\mytest.jpg", ImageFormat.Jpeg);
im.Save(@"C:\mytest.bmp", ImageFormat.Bmp);
}
It works a treat .... obviously you will have to deal with issues such as
the page doesn't fit in the browser screen (so maybe some form re-sizing), or
maybe you don't actually display the browser, and is the saving to be
automatic or at the click of another button, etc.
No matter what else you need to address this code is a good starting point.
Good luck

))