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


C# Pen.ResetTransform方法代碼示例

本文整理匯總了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");
			}
		}
開發者ID:nlhepler,項目名稱:mono,代碼行數:43,代碼來源:PenTest.cs

示例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;
        }
開發者ID:sunpander,項目名稱:VSDT,代碼行數:20,代碼來源:MarkControl.cs

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

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


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