473,398 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

problem with GDI+

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,0x00C C0020 /*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

Nov 15 '05 #1
1 1168
Please try to post the same subject and content only once. This is a busy
group and it doesn't need the extra traffic.

--
Bob Powell [MVP]
C#, System.Drawing

The October edition of Well Formed is now available.
Find out how to use DirectX in a Windows Forms control
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

"dawn" <da******@hotmail.com> wrote in message
news:3y**********************@phobos.telenet-ops.be...
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,0x00C C0020 /*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

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Rodrigo | last post by:
Hi to all: I have build an application with Visual Basic .NET, to start SQL Server replication. For each replication initiated (50 replication each 10 minutes), I create a new thread. The...
1
by: James Dean | last post by:
I am drawing in a picturebox and am having some problems. I display outputted images in the picturebox. If the image is too big for the client area then i have scrollbars. The problem is that once...
4
by: James Dean | last post by:
I am trying to directly set the pixels in a 32ARGB image but for some reason i am not setting them correctly. I have a struct 4 bytes in size... public struct PixelData { public byte Blue;...
1
by: pei_world | last post by:
Hi there, I have a problem about how to keep my draw graphics stay on my control unless I delete them. that means how to resist my graphics. also how to partially remove some graphics from my...
6
by: James dean | last post by:
I have heard that the video drivers in GDI+ are a big performance issue. But is this only an issue with something like Games Programming i think...is this wrong?. What about a drawing application...
7
by: news | last post by:
This may be a stupid question, but if I don't ask I'll never know ;) Ok, here it goes.... I am writing an application that renders an image in one picturebox and a graph in another. The image...
7
by: | last post by:
We create VC++ programs that does some GDI drawing functionality. I discovered GDI+ and this seems to be a big step forward, and appears to be standard available in Windows XP and Windows Server...
2
by: | last post by:
Hi all. I have a very frustrating problem with my VB applications (developed with VS2002/.Net1.0): every application (even "stupid" two-forms application :-( ) seems to allocate GDI resources...
4
by: Andrew Cook | last post by:
I am using Microsoft Visual Basic .net 2002 Standard. I am coding an application which loads in data from a compressed file. One of the items in the file is a raw RGB565 bitmap, at 800x600 pixels. In...
3
by: =?Utf-8?B?dGtpZWhs?= | last post by:
I have large 1bpp tiff scans of arch. drawings that are typically 12032x16890 pixels (filesize is about a 1 meg +/-) While I can readily view smaller (dimension) files, when I try to do anything...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.