Click here to Skip to main content
15,896,153 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
When I draw a multiple line (up to 1000+) I would like to zoom in but keep the line the same width & not at the zoomed scale. At the moment I am drawing to image (Bitmap). Which when zoomed in makes the line fat or zoomed out makes the line thin. I also tried graphics draw which caused a lot of issues with panning & zooming with image loss.

My skill level is low so please try to keep it simple.

In advance thanks.
Posted
Updated 8-Apr-15 9:57am
v2

1 solution

The key here is not to use PictureBox. You could, but it won't help you, will only add hassles and make you waste your development time and some extra system resources. It makes no sense at all, only some harm. It is only good for simplest static things.

I'll tell you what to do instead. Please see my past answers:
Append a picture within picturebox[^],
draw a rectangle in C#[^],
How do I clear a panel from old drawing[^].

See also these answers on further detail on graphics rendering:
What kind of playful method is Paint? (DataGridViewImageCell.Paint(...))[^],
capture the drawing on a panel[^],
Drawing Lines between mdi child forms[^],
How to speed up my vb.net application?[^],
Zoom image in C# .net mouse wheel[^].

Note that the last of these answers is focused on zoom implementation.

That's all. Any further questions?

—SA
 
Share this answer
 
v2
Comments
Knight school 10-Apr-15 13:21pm    
Thanks,
I am running picturebox on panel of a SplitContainer. Don't think I can draw direct on the panel. The other reasons for picturebox was I can pan/Zoom (i.e. Move/ resize picturebox). This is only way I know how to zoom without transform & redraw (time consuming). I would normally use the paint event but the drawing requires thousand of calcs for all the point and drawing (which refresh would be a draw, but a draw to image would save all drawn detail). I hope this explain so it is understandable & I really don't know if it is the correct way (Still learning & still making a lot of mistakes)
Sergey Alexandrovich Kryukov 10-Apr-15 14:57pm    
You don't have to draw on panel, you have to draw on your own custom control designed by you for this purpose.
Forget PictureBox. I provided you detailed explanation on what you can do, please you it.
—SA

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