放大.NET矩形矩形、NET

2023-09-06 06:02:54 作者:等风来

在一个WinForm我用Microsoft.VisualBasic.PowerPacks的矩形,椭圆和直线。

In a WinForm I use rectangles, ovals and lines of Microsoft.VisualBasic.PowerPacks.

是否有可能使一个变焦就可以了?怎么样?

Is it possible to make a zoom on it? How?

推荐答案

假设你只是用它们来画画,没有输入控件,做到这一点。

Assuming you are just using them to draw pictures, there are no input controls, do this.

1),将它们移动到用户控件 2)把表单上的用户控件 - 但设置可见=假 3)在窗体的负载,调用用户控件的DrawToBitmap,将其保存 4)在油漆...绘制位图的形式,根据您的变焦缩放它。 5)看家...如果该用户控件的变化,刷新位图;如果缩放或位图的变化,无效的形式。

1) Move them to a usercontrol 2) Put the usercontrol on the form - but set visible=false 3) In the load of the form, call the usercontrol's DrawToBitmap, saving it 4) In the paint ... Draw the bitmap to the form, scaling it per your zoom. 5) housekeeping...If the usercontrol changes, refresh the bitmap; if zoom or bitmap change, invalidate the form.

祝你好运; - )