Увеличение и уменьшение масштаба 2D-графики C#
i have to ZOOM-IN & ZOOM-OUT 2D-graphics like (line, Rectangle, circle) which i have draw on winform. I am not used any picture box, panel. I crated simple program to draw circle & on button click try to zoom but it showing error "parameter is not valid" in method Drawing() @ Line- DeviceContexct.Transform = mainViewTransform;
Что я уже пробовал:
<pre>public Graphics DeviceContexct; public Matrix mainViewTransform = new Matrix(); private void ScalingCircle_Paint( object sender, PaintEventArgs e ) { Pen myPen = new Pen(Color.Blue, 1); e.Graphics.DrawRectangle(myPen, 50, 50, 100, 100); mainViewTransform.Scale(3, 2); DeviceContexct = e.Graphics; } private void Drawing(Graphics gr) { Pen myPen2 = new Pen(Color.Red, 1); DeviceContexct.Transform = mainViewTransform; DeviceContexct.DrawRectangle(myPen2, 50, 50, 100, 100); } private void button1_Click( object sender, EventArgs e ) { Drawing(DeviceContexct); }
Maciej Los
Проверить это: Создание поверхности конструктора с помощью Windows Forms и GDI+ в Microsoft .NET[^]