本文整理汇总了C#中System.Drawing.Graphics.TranslateTransform方法的典型用法代码示例。如果您正苦于以下问题:C# Graphics.TranslateTransform方法的具体用法?C# Graphics.TranslateTransform怎么用?C# Graphics.TranslateTransform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Graphics
的用法示例。
在下文中一共展示了Graphics.TranslateTransform方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TranslateTransformAngleMatrixOrder
private void TranslateTransformAngleMatrixOrder(PaintEventArgs e)
{
// Set world transform of graphics object to rotate.
e.Graphics.RotateTransform(30.0F);
// Then to translate, appending to world transform.
e.Graphics.TranslateTransform(100.0F, 0.0F, MatrixOrder.Append);
// Draw rotated, translated ellipse to screen.
e.Graphics.DrawEllipse(new Pen(Color.Blue, 3), 0, 0, 200, 80);
}
示例2: TranslateTransformAngle
private void TranslateTransformAngle(PaintEventArgs e)
{
// Set world transform of graphics object to rotate.
e.Graphics.RotateTransform(30.0F);
// Then to translate, prepending to world transform.
e.Graphics.TranslateTransform(100.0F, 0.0F);
// Draw translated, rotated ellipse to screen.
e.Graphics.DrawEllipse(new Pen(Color.Blue, 3), 0, 0, 200, 80);
}
示例3: Main
//引入命名空间
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
class RotatedRectangles: Form
{
public static void Main()
{
Application.Run(new RotatedRectangles());
}
public RotatedRectangles()
{
Text = "Rotated Rectangles";
ResizeRedraw = true;
}
protected override void OnPaint(PaintEventArgs pea)
{
DoPage(pea.Graphics, ForeColor,ClientSize.Width, ClientSize.Height);
}
protected void DoPage(Graphics grfx, Color clr, int cx, int cy)
{
Pen pen = new Pen(clr);
grfx.PageUnit = GraphicsUnit.Pixel;
PointF[] aptf = { (PointF) grfx.VisibleClipBounds.Size };
grfx.PageUnit = GraphicsUnit.Inch;
grfx.PageScale = 0.01f;
grfx.TransformPoints(CoordinateSpace.Page,
CoordinateSpace.Device, aptf);
grfx.TranslateTransform(aptf[0].X / 2, aptf[0].Y / 2);
for (int i = 0; i < 6; i++)
{
grfx.DrawRectangle(pen, 0, 0, 200, 200);
grfx.RotateTransform(10);
}
}
}