Drawing an image

  • Thread starter Thread starter Alberto
  • Start date Start date
A

Alberto

I'm drawing an image in a panel control with this sentence in the Paint
method:

e.Graphics.DrawImageUnscaled(Image, panelImage.AutoScrollPosition);

The problem is that I only want to paint a region of the image specified by
a Rectangle object. I can do it with:

e.Graphics.DrawImageUnscaled(Imagen, myRectangle);

but, in this case, if the user moves the image with the scroll bars, it
isn't shown properly.

What can I do? Thank you in advance.
 
Rather than drawing in the panel why don't you put a PictureBox in the panel
and load the image into that, then resize and position the PictureBox, the
autoscroll on the panel will then let you move around the image.
 
I just inserted the image control and the panel but now I don't know how to
show the scrollbars when the image is bigger than the size of the image
control.

Thanks for your help.
 
Just set the panels autoscroll property to true and the scrollbars appear
when needed.
 

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

Back
Top