资源描述:
《坐标系的变化与图形变换》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、坐标系的变化与图形变换privatevoidForm1_Paint(objectsender,PaintEventArgse){Graphicsg=e.Graphics;g.FillRectangle(Brushes.White,this.ClientRectangle);g.DrawRectangle(Pens.Black,10,10,50,50);g.DrawEllipse(Pens.Black,10,10,10,10);g.ScaleTransform(2.0f,3.0f);g.DrawRectangle(Pen
2、s.Black,10,10,50,50);g.DrawEllipse(Pens.Black,10,10,10,10);g.ScaleTransform(0.5f,0.3333333f);g.DrawRectangle(Pens.Red,20,30,100,150);g.DrawEllipse(Pens.Red,20,30,20,30);}privatevoidbutton1_Click(objectsender,EventArgse){Graphicsg=this.CreateGraphics();g.FillRect
3、angle(Brushes.White,this.ClientRectangle);Fontf=newFont("TimesNewRoman",24);g.DrawString("Traslation",f,Brushes.Black,0,0);g.TranslateTransform(150,75);g.DrawString("Traslation",f,Brushes.Black,0,0);} privatevoidbutton2_Click(objectsender,EventArgse){Graphicsg=t
4、his.CreateGraphics();g.FillRectangle(Brushes.White,this.ClientRectangle);for(inti=1;i<=5;++i){g.DrawRectangle(Pens.Black,10,10,30,50);g.TranslateTransform(2,10);}} privatevoidbutton3_Click(objectsender,EventArgse){Graphicsg=this.CreateGraphics();g.FillRectangle(
5、Brushes.White,this.ClientRectangle);g.DrawEllipse(Pens.Black,20,20,30,50);g.TranslateTransform(-15,0);g.DrawEllipse(Pens.Black,20,20,30,50);g.ResetTransform();g.TranslateTransform(0,30);g.DrawEllipse(Pens.Black,20,20,30,50);} privatevoidbutton4_Click(objectsende
6、r,EventArgse){Graphicsg=this.CreateGraphics();g.FillRectangle(Brushes.White,this.ClientRectangle);Fontf=newFont("TimesNewRoman",24);g.DrawString("Rotation",f,Brushes.Black,0,0);g.RotateTransform(45);g.TranslateTransform(100,10);g.DrawString("Rotation",f,Brushes.
7、Black,0,0);} privatevoidbutton5_Click(objectsender,EventArgse){Graphicsg=this.CreateGraphics();g.FillRectangle(Brushes.White,this.ClientRectangle);Fontf=newFont("TimesNewRoman",16);for(floatangle=0;angle<360;angle+=45){g.ResetTransform();g.TranslateTransform(Cli
8、entRectangle.Width/2,ClientRectangle.Height/2);g.RotateTransform(angle);g.DrawString("HelloWorld",f,Brushes.Red,50,0);}} privatevoidbutton6_Click(objectsender,EventAr