problem with GDI+

D

dawn

Hi,

With the code I use to capture part of a form, an error shows up : External
GDI+ error

the code is the following

private void button3_Click(object sender, System.EventArgs e)
{

resdial.Activate() ;

System.IntPtr srcDC=GetDC(resdial.axWebBrowser1.Handle);

Bitmap bm=new Bitmap(50,50);

Graphics g=Graphics.FromImage(bm);

System.IntPtr bmDC=g.GetHdc();


BitBlt(bmDC,0,0,bm.Width,bm.Height,srcDC,0,0,0x00CC0020 /*SRCCOPY*/);

this.pictureBox1.Image = System.Drawing.Image.FromHbitmap(bmDC);


ReleaseDC(srcDC);

g.ReleaseHdc(bmDC);

g.Dispose();



}



The line that gives the error is

this.pictureBox1.Image = System.Drawing.Image.FromHbitmap(bmDC);



What's wrong with this?



Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top