本文整理汇总了C#中System.Drawing.Pen.ResetTransform方法的典型用法代码示例。如果您正苦于以下问题:C# Pen.ResetTransform方法的具体用法?C# Pen.ResetTransform怎么用?C# Pen.ResetTransform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Pen
的用法示例。
在下文中一共展示了Pen.ResetTransform方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Transform_Operations
public void Transform_Operations ()
{
using (Pen p = new Pen (Brushes.Red)) {
Matrix clone = p.Transform.Clone ();
Matrix mul = clone.Clone ();
clone.Multiply (mul, MatrixOrder.Append);
p.MultiplyTransform (mul, MatrixOrder.Append);
Assert.AreEqual (p.Transform, clone, "Multiply/Append");
clone.Multiply (mul, MatrixOrder.Prepend);
p.MultiplyTransform (mul, MatrixOrder.Prepend);
Assert.AreEqual (p.Transform, clone, "Multiply/Prepend");
clone.Rotate (45, MatrixOrder.Append);
p.RotateTransform (45, MatrixOrder.Append);
Assert.AreEqual (p.Transform, clone, "Rotate/Append");
clone.Rotate (45, MatrixOrder.Prepend);
p.RotateTransform (45, MatrixOrder.Prepend);
Assert.AreEqual (p.Transform, clone, "Rotate/Prepend");
clone.Scale (0.25f, 2, MatrixOrder.Append);
p.ScaleTransform (0.25f, 2, MatrixOrder.Append);
Assert.AreEqual (p.Transform, clone, "Scale/Append");
clone.Scale (0.25f, 2, MatrixOrder.Prepend);
p.ScaleTransform (0.25f, 2, MatrixOrder.Prepend);
Assert.AreEqual (p.Transform, clone, "Scale/Prepend");
clone.Translate (10, 20, MatrixOrder.Append);
p.TranslateTransform (10, 20, MatrixOrder.Append);
Assert.AreEqual (p.Transform, clone, "Translate/Append");
clone.Translate (30, 40, MatrixOrder.Prepend);
p.TranslateTransform (30, 40, MatrixOrder.Prepend);
Assert.AreEqual (p.Transform, clone, "Translate/Prepend");
clone.Reset ();
p.ResetTransform ();
Assert.AreEqual (p.Transform, clone, "Reset");
}
}
示例2: UserControl1_Load
private void UserControl1_Load(object sender, EventArgs e)
{
_myFont = new Font("Lucida Console", 8);
_myBrush = new SolidBrush(Color.Black);
_myBlueBrush = new SolidBrush(Color.Blue);
_myPen = new System.Drawing.Pen(Color.Black);
_myPen.ResetTransform();
_myPen.Width = 1;
_myPen.StartCap = LineCap.Round;
_myPen.EndCap = LineCap.Round;
_myPen.DashStyle = DashStyle.Solid;
_myBluePen = new System.Drawing.Pen(Color.Blue);
_myBluePen.ResetTransform();
_myBluePen.Width = 1;
_myBluePen.StartCap = LineCap.ArrowAnchor;
_myBluePen.EndCap = LineCap.Round;
_myBluePen.DashStyle = DashStyle.Solid;
}
示例3: ResetTransform
public void ResetTransform ()
{
using (Matrix m = new Matrix (2, 0, 0, 2, 10, -10)) {
using (Pen p = new Pen (Brushes.Red)) {
p.Transform = m;
Assert.IsFalse (p.Transform.IsIdentity, "Transform.IsIdentity");
p.ResetTransform ();
Assert.IsTrue (p.Transform.IsIdentity, "Reset.IsIdentity");
}
}
}
示例4: CheckMethods
void CheckMethods (Pen pen, String tag)
{
// Try modifying a SystemPen by calling methods.
// ArgumentException must be thrown in some cases.
/*
try {
// NotImplemented
pen.SetLineCap (LineCap.Flat, LineCap.Round, DashCap.Triangle);
Assert.Fail (tag + "#1: must throw ArgumentException");
} catch (ArgumentException) {
Assert.IsTrue (tag + "#1", true);
}
*/
pen.ResetTransform ();
pen.RotateTransform (90);
pen.ScaleTransform (2, 1);
pen.TranslateTransform (10, 20);
pen.MultiplyTransform (new Matrix ());
pen.Clone ();
try {
pen.Dispose ();
Assert.Fail (tag + "#8: must throw ArgumentException");
} catch (ArgumentException) {
Assert.IsTrue (true, tag + "#8");
}
}