本文整理匯總了C#中System.Drawing.Pen.MultiplyTransform方法的典型用法代碼示例。如果您正苦於以下問題:C# Pen.MultiplyTransform方法的具體用法?C# Pen.MultiplyTransform怎麽用?C# Pen.MultiplyTransform使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Drawing.Pen
的用法示例。
在下文中一共展示了Pen.MultiplyTransform方法的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: MultiplyTransform2_InvalidMatrixOrder
public void MultiplyTransform2_InvalidMatrixOrder ()
{
using (Pen p = new Pen (Brushes.Red)) {
Matrix m1 = new Matrix (2, 0.5f, 0.5f, 4, 10, 20);
Matrix m2 = new Matrix (1, 0, 0, 1, -50, -30);
p.Transform = m2;
p.MultiplyTransform (m1, (MatrixOrder) Int32.MinValue);
// no exception, but which order is it ?
Matrix invalid = p.Transform;
p.Transform = m2;
p.MultiplyTransform (m1, MatrixOrder.Append);
Assert.IsTrue (invalid.Equals (p.Transform), "Append");
p.Transform = m2;
p.MultiplyTransform (m1, MatrixOrder.Prepend);
Assert.IsFalse (invalid.Equals (p.Transform), "Prepend");
}
}
示例3: MultiplyTransform_NonInvertible
public void MultiplyTransform_NonInvertible ()
{
using (Matrix noninvertible = new Matrix (123, 24, 82, 16, 47, 30)) {
using (Pen p = new Pen (Brushes.Red)) {
p.MultiplyTransform (noninvertible);
}
}
}
示例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");
}
}