PictureBox problem

J

James Dean

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 i draw a
bitmap to the picturebox I have trouble displaying graphics inside the
picturebox. I

pictureBox1.image = Image.FromFile("OutBinary.bmp");


This image is displayed in the picturebox with scrollbars. Then i try to
do the following. Once i touch the scroll bars the original bitmap image
gets displayed again. How do i change the image to display only the new
polygon data.

_canvasImage.MakeTransparent();
_canvasGraphics = Graphics.FromImage(_canvasImage);

_canvasGraphics.Clear(Color.White);
_canvasGraphics = pictureBox1.CreateGraphics();
SolidBrush brush = new SolidBrush(Color.Black);
_canvasGraphics.Clear(Color.White)

.......do various calculations to get polygon points

_canvasGraphics.FillPolygon(brush,polgon_points);
this.displayscrollbars()
this.setscrollbarvalues();
 
B

Bob Powell [MVP]

Read the #1 GDI+ FAQ

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

Image transition effects, snap-to-grid and Layered Windows are
all discussed in May's edition of Well Formed for C# or VB programmers
http://www.bobpowell.net/currentissue.htm

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

The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top