当前位置: 首页>>代码示例>>C#>>正文


C# LinearGradientBrush.ScaleTransform方法代码示例

本文整理汇总了C#中System.Drawing.Drawing2D.LinearGradientBrush.ScaleTransform方法的典型用法代码示例。如果您正苦于以下问题:C# LinearGradientBrush.ScaleTransform方法的具体用法?C# LinearGradientBrush.ScaleTransform怎么用?C# LinearGradientBrush.ScaleTransform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Drawing.Drawing2D.LinearGradientBrush的用法示例。


在下文中一共展示了LinearGradientBrush.ScaleTransform方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Transform_Operations_OnScalableAngle

		public void Transform_Operations_OnScalableAngle ()
		{
			LinearGradientBrush lgb = new LinearGradientBrush (rect, c1, c2, 360f, true);
			Matrix clone = lgb.Transform.Clone ();
			Matrix mul = clone.Clone ();
			Matrix m = new Matrix ();
			m.Scale (2, 1);
			m.Translate (rect.Width, rect.Height);
			m.Rotate (30f);

			clone.Multiply (mul, MatrixOrder.Append);
			lgb.MultiplyTransform (mul, MatrixOrder.Append);
			Assert.AreEqual (lgb.Transform, clone, "Multiply/Append");

			clone.Multiply (mul, MatrixOrder.Prepend);
			lgb.MultiplyTransform (mul, MatrixOrder.Prepend);
			Assert.AreEqual (lgb.Transform, clone, "Multiply/Prepend");

			clone.Rotate (45, MatrixOrder.Append);
			lgb.RotateTransform (45, MatrixOrder.Append);
			Assert.AreEqual (lgb.Transform, clone, "Rotate/Append");

			clone.Rotate (45, MatrixOrder.Prepend);
			lgb.RotateTransform (45, MatrixOrder.Prepend);
			Assert.AreEqual (lgb.Transform, clone, "Rotate/Prepend");

			clone.Scale (0.25f, 2, MatrixOrder.Append);
			lgb.ScaleTransform (0.25f, 2, MatrixOrder.Append);
			Assert.AreEqual (lgb.Transform, clone, "Scale/Append");

			clone.Scale (0.25f, 2, MatrixOrder.Prepend);
			lgb.ScaleTransform (0.25f, 2, MatrixOrder.Prepend);
			Assert.AreEqual (lgb.Transform, clone, "Scale/Prepend");

			clone.Translate (10, 20, MatrixOrder.Append);
			lgb.TranslateTransform (10, 20, MatrixOrder.Append);
			Assert.AreEqual (lgb.Transform, clone, "Translate/Append");

			clone.Translate (30, 40, MatrixOrder.Prepend);
			lgb.TranslateTransform (30, 40, MatrixOrder.Prepend);
			Assert.AreEqual (lgb.Transform, clone, "Translate/Prepend");

			clone.Reset ();
			lgb.ResetTransform ();
			Assert.AreEqual (lgb.Transform, clone, "Reset");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:46,代码来源:LinearGradientBrushTest.cs

示例2: ScaleTransform_InvalidOrder

		public void ScaleTransform_InvalidOrder ()
		{
			LinearGradientBrush lgb = new LinearGradientBrush (pt1, pt2, c1, c2);
			lgb.ScaleTransform (1, 1, (MatrixOrder) Int32.MinValue);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:5,代码来源:LinearGradientBrushTest.cs

示例3: Transform_Operations

		public void Transform_Operations ()
		{
			LinearGradientBrush lgb = new LinearGradientBrush (rect, c1, c2, 45f);
			Matrix clone = lgb.Transform.Clone ();
			Matrix mul = clone.Clone ();

			clone.Multiply (mul, MatrixOrder.Append);
			lgb.MultiplyTransform (mul, MatrixOrder.Append);
			Assert.AreEqual (lgb.Transform, clone, "Multiply/Append");

			clone.Multiply (mul, MatrixOrder.Prepend);
			lgb.MultiplyTransform (mul, MatrixOrder.Prepend);
			Assert.AreEqual (lgb.Transform, clone, "Multiply/Prepend");

			clone.Rotate (45, MatrixOrder.Append);
			lgb.RotateTransform (45, MatrixOrder.Append);
			Assert.AreEqual (lgb.Transform, clone, "Rotate/Append");

			clone.Rotate (45, MatrixOrder.Prepend);
			lgb.RotateTransform (45, MatrixOrder.Prepend);
			Assert.AreEqual (lgb.Transform, clone, "Rotate/Prepend");

			clone.Scale (0.25f, 2, MatrixOrder.Append);
			lgb.ScaleTransform (0.25f, 2, MatrixOrder.Append);
			Assert.AreEqual (lgb.Transform, clone, "Scale/Append");

			clone.Scale (0.25f, 2, MatrixOrder.Prepend);
			lgb.ScaleTransform (0.25f, 2, MatrixOrder.Prepend);
			Assert.AreEqual (lgb.Transform, clone, "Scale/Prepend");

			clone.Translate (10, 20, MatrixOrder.Append);
			lgb.TranslateTransform (10, 20, MatrixOrder.Append);
			Assert.AreEqual (lgb.Transform, clone, "Translate/Append");

			clone.Translate (30, 40, MatrixOrder.Prepend);
			lgb.TranslateTransform (30, 40, MatrixOrder.Prepend);
			Assert.AreEqual (lgb.Transform, clone, "Translate/Prepend");

			clone.Reset ();
			lgb.ResetTransform ();
			Assert.AreEqual (lgb.Transform, clone, "Reset");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:42,代码来源:LinearGradientBrushTest.cs

示例4: ScaleTransform_MaxMin

		public void ScaleTransform_MaxMin ()
		{
			LinearGradientBrush lgb = new LinearGradientBrush (rect, c1, c2, 0f);
			lgb.ScaleTransform (Single.MaxValue, Single.MinValue);
			float[] elements = lgb.Transform.Elements;
			Assert.AreEqual (Single.MaxValue, elements[0], 1e33, "matrix.0");
			Assert.AreEqual (0, elements[1], 0.1, "matrix.1");
			Assert.AreEqual (0, elements[2], 0.1, "matrix.2");
			Assert.AreEqual (Single.MinValue, elements[3], 1e33, "matrix.3");
			Assert.AreEqual (0, elements[4], 0.1, "matrix.4");
			Assert.AreEqual (0, elements[5], 0.1, "matrix.5");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:12,代码来源:LinearGradientBrushTest.cs

示例5: ScaleTransform_45

		public void ScaleTransform_45 ()
		{
			LinearGradientBrush lgb = new LinearGradientBrush (rect, c1, c2, 45f);
			lgb.ScaleTransform (3, 3);
			float[] elements = lgb.Transform.Elements;
			Assert.AreEqual (3, elements[0], 0.1, "matrix.0");
			Assert.AreEqual (3, elements[1], 0.1, "matrix.1");
			Assert.AreEqual (-3, elements[2], 0.1, "matrix.2");
			Assert.AreEqual (3, elements[3], 0.1, "matrix.3");
			Assert.AreEqual (16, elements[4], 0.1, "matrix.4");
			Assert.AreEqual (-16, elements[5], 0.1, "matrix.5");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:12,代码来源:LinearGradientBrushTest.cs

示例6: ScaleTransform

		public void ScaleTransform ()
		{
			LinearGradientBrush lgb = new LinearGradientBrush (rect, c1, c2, 0f);
			lgb.ScaleTransform (2, 4);
			float[] elements = lgb.Transform.Elements;
			Assert.AreEqual (2, elements[0], 0.1, "matrix.0");
			Assert.AreEqual (0, elements[1], 0.1, "matrix.1");
			Assert.AreEqual (0, elements[2], 0.1, "matrix.2");
			Assert.AreEqual (4, elements[3], 0.1, "matrix.3");
			Assert.AreEqual (0, elements[4], 0.1, "matrix.4");
			Assert.AreEqual (0, elements[5], 0.1, "matrix.5");

			lgb.ScaleTransform (0.5f, 0.25f);
			Assert.IsTrue (lgb.Transform.IsIdentity, "Transform.IsIdentity");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:15,代码来源:LinearGradientBrushTest.cs

示例7: Rectangle

		public void Rectangle ()
		{
			LinearGradientBrush lgb = new LinearGradientBrush (rect, c1, c2, 0f);
			CheckDefaultRectangle ("Original", lgb.Rectangle);
			lgb.MultiplyTransform (new Matrix (2, 0, 0, 2, 2, 2));
			CheckDefaultRectangle ("Multiply", lgb.Rectangle);
			lgb.ResetTransform ();
			CheckDefaultRectangle ("Reset", lgb.Rectangle);
			lgb.RotateTransform (90);
			CheckDefaultRectangle ("Rotate", lgb.Rectangle);
			lgb.ScaleTransform (4, 0.25f);
			CheckDefaultRectangle ("Scale", lgb.Rectangle);
			lgb.TranslateTransform (-10, -20);
			CheckDefaultRectangle ("Translate", lgb.Rectangle);

			lgb.SetBlendTriangularShape (0.5f);
			CheckDefaultRectangle ("SetBlendTriangularShape", lgb.Rectangle);
			lgb.SetSigmaBellShape (0.5f);
			CheckDefaultRectangle ("SetSigmaBellShape", lgb.Rectangle);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:20,代码来源:LinearGradientBrushTest.cs

示例8: genPlayButton

        Image genPlayButton()
        {
            Image play = new Bitmap(132, 32);
            Image icon = Bitmap.FromFile(Application.StartupPath + "\\icons\\play.png");

            ColorBlend blend = new ColorBlend();
            blend.Positions = new float[] { 0, 0.5f, 1 };
            blend.Colors = new Color[] { Color.FromArgb(100, Color.Gray), Color.FromArgb(192, 107, 107, 107), Color.FromArgb(192, 159, 159, 159) };

            LinearGradientBrush gradientBrush = new LinearGradientBrush(new Rectangle(0, 0, 1, 1), Color.Black, Color.Black, 0, false);
            gradientBrush.InterpolationColors = blend;

            gradientBrush.ResetTransform();
            gradientBrush.ScaleTransform(64, 64);
            gradientBrush.RotateTransform(90);

            Graphics gfx = Graphics.FromImage(play);
            gfx.SmoothingMode = SmoothingMode.HighQuality;

            gfx.FillPie(gradientBrush, new Rectangle(0, 0, 132, 64), 180, 180); //background
            gfx.DrawPie(new Pen(Color.Black, 4), new Rectangle(2, 2, 128, 56), 180, 180); //outline
            gfx.DrawImage(icon, 50, 0); //icon

            gradientBrush.Dispose();
            gfx.Dispose();
            icon.Dispose();

            return play;
        }
开发者ID:Winterstark,项目名称:Tesserax,代码行数:29,代码来源:Main.cs


注:本文中的System.Drawing.Drawing2D.LinearGradientBrush.ScaleTransform方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。