Click here to Skip to main content
15,742,973 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All

I want to allow zoom in, zoom out , scrolling in picture box.

How can I do it simply

Thanks in advance
Updated 25-Jul-12 12:03pm
Nueman 25-Jul-12 18:03pm    
Improve readability

1 solution

The control System.Windows.Forms.PictureBox is not suitable for such operations. Yes, you can implement them, but the control functionality won't help you; it will only present extra hassles, eat up extra resources and your development time giving nothing in return. Don't torture yourself — this control is designed only for the simplest cases, with static or almost static (rarely replaced) preexisting images.

What you really need is using a custom control derived from System.Windows.Forms.Control; the image should be rendered in the overridden method OnPaint. Please see my past answer explaining further detail:
How do I clear a panel from old drawing[^],
draw a rectangle in C#[^],
Append a picture within picturebox[^].

See also:
Drawing Lines between mdi child forms[^],
capture the drawing on a panel[^],
What kind of playful method is Paint? (DataGridViewImageCell.Paint(...))[^].

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900