Partial Clsi of a Picturebox

Partial Clsi of a Picturebox

Post by Andy D » Thu, 05 Feb 2004 18:41:26

Hi all,

I'm doing some text printing and line drawing on a picturebox thru standard
.Print and .Line methods.
The picturebox .Picture property is set to a background picture on top of
which I do the drawing.
When I need to update the data displayed, I call the .Cls method to erase
all previous printing and drawing and redo everything.
Since the data printed is pretty complex, I was wondering if there's a way
to just clear a specific area of the hDC.
That of course wouldn't have to mess with the background picture but just
with text and lines.

Can it be done?

Thanks in advance,


Partial Clsi of a Picturebox

Post by Mike D Sut » Thu, 05 Feb 2004 20:48:53

> I'm doing some text printing and line drawing on a picturebox thru standard

Sure; the background picture is simply an API Bitmap wrapped in a StdPicture object, so simply select it into a DC and blit from it
to your picture box surface. Here's an old post with example code of how to do this if you need it: %23ljr%23te4DHA.1592%40TK2MSFTNGP10.phx.gbl
Hope this helps,


- Microsoft Visual Basic MVP -


Partial Clsi of a Picturebox

Post by Larry Serf » Thu, 05 Feb 2004 23:01:01

"Andy DF" < XXXX@XXXXX.COM > wrote

Did you try using PaintPicture to copy that portion of the Picture onto itself?


Partial Clsi of a Picturebox

Post by jeff » Sun, 08 Feb 2004 01:21:55

Instead of using .Print and .Line methods on picturebox it sounds like
you should be creating vector format ( ex metafile ) image so each
line, or text is an object within the image. Then you could just
remove or update the elements you want to get rid of. You could do
this with API calls or use a component designed for this purpose. I'm
biased of course - our MetaDraw control would be ideal, but it's not
the only way. Other nice thing about working with metafiles is that
they will zoom and print much cleaner and take up less space when
saved. Also you can trap user actions on a part of the image - for
instance a click on a line.

Hope this is helpful.

* * Please include a copy of this note with your reply

Jeff Bennett

Bennet-Tec Information Systems, Inc
50 Jericho Tpk, Jericho, NY 11753
Phone 516 997 5596, Fax - 5597

RELIABLE Component Software
and Software Development Services
* TList/Pro * ALLText HT/Pro * MetaDraw *

====================== ======================