现在的位置: 首页 > 综合 > 正文

c# 图形移动与旋转

2012年12月25日 ⁄ 综合 ⁄ 共 1341字 ⁄ 字号 评论关闭

1 、旋转

e.Graphics.RotateTransform(30.0F, MatrixOrder.Prepend);

2、平移

 e.Graphics.TranslateTransform(100.0F, 0.0F);

3、缩放

 e.Graphics.ScaleTransform(3.0F, 1.0F, MatrixOrder.Append);
4、点坐标变换

            e.Graphics.TranslateTransform(40, 30);
            e.Graphics.TransformPoints(CoordinateSpace.Page, CoordinateSpace.World, points);
            e.Graphics.ResetTransform();

Code

 

5、选择参数:将此变换参数放在已有的变换矩阵之后还是之前。MatrixOrder.Append//MatrixOrder.Prepend  

//----------------旋转和平移的顺序不一样,得到的结果页不一样。

6、辅助功能

 GraphicsState transState = e.Graphics.Save();//保存当前绘图板状态

e.Graphics.ResetTransform();//重置

e.Graphics.Restore(transState);//置为此状态

抱歉!评论已关闭.