By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,056 Members | 1,320 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,056 IT Pros & Developers. It's quick & easy.

Why does unmanaged OnPaint functions give OnResize errors

P: n/a
I have a PictureBox where the overriden OnPaint method looks like this:
IntPtr hdc = e.Graphics.GetHdc();
DLLWrapper.DLLWrapperDrawFrame(hdc, 0, 0, this.Width, this.Height);
The DLLWrapper function causes hdc not to be released and error "Object
is used elsewhere" appears.
The strang fact is that it only occurs when I resize the window. Even
the VS .NET 2003 environment tells in the PictureBox that the object is
being used elsewhere.
Does anyone know a workaround?

Sep 22 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.