Jay, You have given me much to think about. Before I answer your questions
I wonder about my basic design (which really came from a VB6 UserControl)
and want to thank you up front!
I have a UserControl which contains a Picturebox. I thus get picturebox that
scrolls. also if the control is larger than the box, the box is centered and
has a colored area around it.
If I drew directly on the Usercontrol how would I get scrollbars to appear.
Wouldn't the control just clip?
==================
To make the picturebox persistent I do not draw on it but rather draw on a
bitmap using a Graphics object obtained as follows:
Public Function PicCreateGraphics() As Graphics
'Client should dispose this
PicCreateGraphics = Graphics.FromImage(mDocumentImage)
End Function
and do:
Private Sub picDocument_Paint(ByVal sender As Object, ByVal e As--snip
e.Graphics.DrawImage(mDocumentImage, 0, 0)
-snip
Now I wonder if I couldn't just use the Picturebox's Image instead of an
additional bitmap.
Can't I draw on the Picturebox's Image like I now draw on the bitmap?
And to get presistance do:
e.Graphics.DrawImage(mMyPicturebox.Image, 0, 0)
=======================
The only nonControl thing I use from the PictureBox is the Image.
The following is an example (picDocument is the Picturebox):
Public Sub PSet(ByVal x As Integer, ByVal y As Integer, ByVal NewColor As
Color)
CType(picDocument.Image, Drawing.Bitmap).SetPixel(PixelToUnitX(x),
PixelToUnitY(y), NewColor)
End Sub
Haven't used this yet but how would I do this if I used a Control instead
of a Picturebox?
====
I read some of the stuff at the bobpowell site and will read more. Thanks
for showing me that.
Jay B. Harlow said:
SamSpade,
How are you "painting" on the PictureBox?
Does the following from the GDI+ FAQ help?
http://www.bobpowell.net/pictureboxhowto.htm
The GDI+ FAQ itself can be found at:
http://www.bobpowell.net/faqmain.htm
Rather then attempt to paint on a PictureBox, which is really designed to
display image files. I normally create a custom control that inherits
directly from Control or UserControl and do the painting in its Paint event
(OnPaint method really).
Are you flat out running your code or are you trying to single step it? Are
you on dual monitors so the debugger does not cause a repaint before the
Refresh itself causes the repaint?
Single stepping with single montior - never gave this a thought!
Can you post a short 15-20 line program that fully demonstrates the problem
you are having?
I looked and think it would have to be quite long.