EDN Admin
Well-known member
Here is the code I am having issues with...
<pre class="prettyprint public Bitmap copyFrame(PictureBox src, RectangleF rect)
{
Graphics g = src.CreateGraphics();
Bitmap image = new Bitmap(src.Width, src.Height, g);
Graphics graphics = Graphics.FromImage(image);
IntPtr hdc = g.GetHdc();
IntPtr hdcDest = graphics.GetHdc();
int rw = (int)Math.Round(rect.Width);
int rh = (int)Math.Round(rect.Height);
int rx = (int)Math.Round(rect.X);
int ry = (int)Math.Round(rect.Y);
BitBlt(hdcDest, 0, 0, rw, rh, hdc, rx, ry, 0xCC0020);
Bitmap bitmap = (Bitmap)image.Clone();
g.ReleaseHdc(hdc);
graphics.ReleaseHdc(hdcDest);
g.Dispose();
graphics.Dispose();
return bitmap;
}[/code]
The error states that: The name bitblt does not exist in the current context...
What am I doing wrong, and how do I fix it?
View the full article
<pre class="prettyprint public Bitmap copyFrame(PictureBox src, RectangleF rect)
{
Graphics g = src.CreateGraphics();
Bitmap image = new Bitmap(src.Width, src.Height, g);
Graphics graphics = Graphics.FromImage(image);
IntPtr hdc = g.GetHdc();
IntPtr hdcDest = graphics.GetHdc();
int rw = (int)Math.Round(rect.Width);
int rh = (int)Math.Round(rect.Height);
int rx = (int)Math.Round(rect.X);
int ry = (int)Math.Round(rect.Y);
BitBlt(hdcDest, 0, 0, rw, rh, hdc, rx, ry, 0xCC0020);
Bitmap bitmap = (Bitmap)image.Clone();
g.ReleaseHdc(hdc);
graphics.ReleaseHdc(hdcDest);
g.Dispose();
graphics.Dispose();
return bitmap;
}[/code]
The error states that: The name bitblt does not exist in the current context...
What am I doing wrong, and how do I fix it?
View the full article