Picturebox

  • Thread starter Thread starter Some Guy
  • Start date Start date
S

Some Guy

Hi there,

Can anybody give me some pointers on the best way to display an image and
allow zooming and scrolling? I have tried resizing the picturebox with
maintainaspectratio set to true but it has the weird effect of moving the
image off screen, rather than resizing it.

If the image being viewed is smaller than the form area I'd like it
centered, like a canvas in a graphics app.

A little confused.... any help appreciated...

Cheers
 
To display an image that's larger than the available area put your
picturebox inside a panel with autoscroll enabled. You can scrolll it around
easily. To display an image centered you might have to dynamically position
the picturebox at runtime.

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

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

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

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
Back
Top