當前位置: 首頁>>代碼示例>>C#>>正文


C# Pen.RotateTransform方法代碼示例

本文整理匯總了C#中System.Drawing.Pen.RotateTransform方法的典型用法代碼示例。如果您正苦於以下問題:C# Pen.RotateTransform方法的具體用法?C# Pen.RotateTransform怎麽用?C# Pen.RotateTransform使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Drawing.Pen的用法示例。


在下文中一共展示了Pen.RotateTransform方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: RotateTransform

		public void RotateTransform ()
		{
			using (Pen p = new Pen (Brushes.Red)) {
				p.RotateTransform (90);
				float[] elements = p.Transform.Elements;
				Assert.AreEqual (0, elements[0], 0.1, "matrix.0");
				Assert.AreEqual (1, elements[1], 0.1, "matrix.1");
				Assert.AreEqual (-1, elements[2], 0.1, "matrix.2");
				Assert.AreEqual (0, elements[3], 0.1, "matrix.3");
				Assert.AreEqual (0, elements[4], 0.1, "matrix.4");
				Assert.AreEqual (0, elements[5], 0.1, "matrix.5");

				p.RotateTransform (270);
				Assert.IsTrue (p.Transform.IsIdentity, "Transform.IsIdentity");
			}
		}
開發者ID:nlhepler,項目名稱:mono,代碼行數:16,代碼來源:PenTest.cs

示例2: 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");
			}
		}
開發者ID:nlhepler,項目名稱:mono,代碼行數:43,代碼來源:PenTest.cs

示例3: 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");
			}
		}
開發者ID:nlhepler,項目名稱:mono,代碼行數:27,代碼來源:TestSystemPens.cs


注:本文中的System.Drawing.Pen.RotateTransform方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。