D
dawn
Hi,
I'm trying to capture part of Form2 into a bitmap when I click on a button
on the main form (form1). After advice I'm using the following code :
System.IntPtr srcDC=GetDC(Form2.axWebBrowser1.Handle);
Bitmap bm=new Bitmap(50,50);
Graphics g=Graphics.FromImage(bm);
System.IntPtr bmDC=g.GetHdc();
BitBlt(bmDC,250,250,bm.Width,bm.Height,srcDC,0,0,0x00CC0020 /*SRCCOPY*/);
this.pictureBox1.Image = System.Drawing.Image.FromHbitmap(bmDC);
ReleaseDC(srcDC);
g.ReleaseHdc(bmDC);
g.Dispose();
}
Only this doesn't work. cuz on the first line the compiler doesn't recognize
Form2.axWebBrowser1.Handle . I've made it public, but now it says an object
reference is needed for axWebBrowser1.
Is there a way I can get the handle for axWebBrowser1 on Form2??
Thanks.
I'm trying to capture part of Form2 into a bitmap when I click on a button
on the main form (form1). After advice I'm using the following code :
System.IntPtr srcDC=GetDC(Form2.axWebBrowser1.Handle);
Bitmap bm=new Bitmap(50,50);
Graphics g=Graphics.FromImage(bm);
System.IntPtr bmDC=g.GetHdc();
BitBlt(bmDC,250,250,bm.Width,bm.Height,srcDC,0,0,0x00CC0020 /*SRCCOPY*/);
this.pictureBox1.Image = System.Drawing.Image.FromHbitmap(bmDC);
ReleaseDC(srcDC);
g.ReleaseHdc(bmDC);
g.Dispose();
}
Only this doesn't work. cuz on the first line the compiler doesn't recognize
Form2.axWebBrowser1.Handle . I've made it public, but now it says an object
reference is needed for axWebBrowser1.
Is there a way I can get the handle for axWebBrowser1 on Form2??
Thanks.