Panel Drawing zoom in C#

前端 未结 2 1364
轮回少年
轮回少年 2020-12-19 16:40

I have a Form that contain a panel, and in this panel I draw shapes, like rectangles and circles, I need to zoom into this shapes, I saw couple options but most of them usin

2条回答
  •  囚心锁ツ
    2020-12-19 17:02

    Since you're drawing from scratch, couldn't you resize you drawing base on zoom factor?

    You could multiply your drawing dimensions by your zoom factor. Assuming your zoom factor would be:

    • 0.5 for 50 % zoom (which would reduce the drawing size)
    • 1.0 for 100% (Real size)
    • 1.5 for 150 % (bigger size), you could calc the width this way:
    object.Width = originalWidth * zoomFactor;
    

提交回复
热议问题