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


C# PathGradientBrush.SetBlendTriangularShape方法代碼示例

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


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

示例1: gradient

 public void gradient(Point[] points, PathGradientBrush pgbrush, Triangle tre, GraphicsPath brushPath)
 {
     Color[] mySurroundColor = { tre.v1.currColor, tre.v2.currColor, tre.v3.currColor};
     pgbrush.SurroundColors = mySurroundColor;
     int averageR = (tre.v1.currColor.R + tre.v2.currColor.R + tre.v3.currColor.R) / 3;
     int averageG = (tre.v1.currColor.G + tre.v2.currColor.G + tre.v3.currColor.G) / 3;
     int averageB = (tre.v1.currColor.B + tre.v2.currColor.B + tre.v3.currColor.B) / 3;
     Color centerCol = Color.FromArgb((byte) averageR, (byte)averageG, (byte)averageB);
     pgbrush.CenterColor = centerCol;
     pgbrush.SetBlendTriangularShape(0.7f, 0.7f);
     graphics.FillPolygon(pgbrush, points);
     pgbrush.Dispose();
 }
開發者ID:arapovavikka,項目名稱:Triangulation,代碼行數:13,代碼來源:Form1.cs

示例2: DrawMenuButtonDropShadow

        /// <summary>
        /// Draw a gradient shadow effect
        /// </summary>
        private void DrawMenuButtonDropShadow(Graphics g, RectangleF bounds, int depth, int opacity)
        {
            // offset shadow dimensions
            RectangleF shadowBounds = bounds;
            shadowBounds.Inflate(1, 1);
            shadowBounds.Offset(depth, depth);

            // create a clipping region
            bounds.Inflate(1, 1);
            using (GraphicsPath clipPath = CreateRoundRectanglePath(
                g,
                bounds.X, bounds.Y,
                bounds.Width, bounds.Height,
                CornerRadius))
            {
                // clip the interior
                using (Region region = new Region(clipPath))
                    g.SetClip(region, CombineMode.Exclude);
            }

            // create a graphics path
            using (GraphicsPath gp = CreateRoundRectanglePath(g, shadowBounds.X, shadowBounds.Y,
                shadowBounds.Width, shadowBounds.Height, 8))
            {
                // draw with a path brush
                using (PathGradientBrush borderBrush = new PathGradientBrush(gp))
                {
                    borderBrush.CenterColor = Color.FromArgb(opacity, Color.Black);
                    borderBrush.SurroundColors = new Color[] { Color.Transparent };
                    borderBrush.SetBlendTriangularShape(.5f, 1.0f);
                    borderBrush.FocusScales = new PointF(.4f, .5f);
                    g.FillPath(borderBrush, gp);
                    g.ResetClip();
                }
            }
        }
開發者ID:Egoily,項目名稱:CSharp-EAlbum,代碼行數:39,代碼來源:MediaButton.cs

示例3: SetBlendTriangularShape_ScaleTooBig

		public void SetBlendTriangularShape_ScaleTooBig ()
		{
			using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
				pgb.SetBlendTriangularShape (1, 1.01f);
			}
		}
開發者ID:nlhepler,項目名稱:mono,代碼行數:6,代碼來源:PathGradientBrushTest.cs

示例4: SetBlendTriangularShape_FocusTooSmall

		public void SetBlendTriangularShape_FocusTooSmall ()
		{
			using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
				pgb.SetBlendTriangularShape (-1);
			}
		}
開發者ID:nlhepler,項目名稱:mono,代碼行數:6,代碼來源:PathGradientBrushTest.cs

示例5: SetBlendTriangularShape_Scale

		public void SetBlendTriangularShape_Scale ()
		{
			using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
				// max valid
				pgb.SetBlendTriangularShape (0, 1);
				Assert.IsTrue (pgb.Transform.IsIdentity, "Transform.IsIdentity-1");
				// min valid
				pgb.SetBlendTriangularShape (1, 0);
				Assert.IsTrue (pgb.Transform.IsIdentity, "Transform.IsIdentity-1");
				// middle
				pgb.SetBlendTriangularShape (0.5f, 0.5f);
				Assert.IsTrue (pgb.Transform.IsIdentity, "Transform.IsIdentity-1");
				// no impact on matrix
			}
		}
開發者ID:nlhepler,項目名稱:mono,代碼行數:15,代碼來源:PathGradientBrushTest.cs

示例6: Rectangle

		public void Rectangle ()
		{
			using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.TileFlipXY)) {
				CheckDefaultRectangle ("Original", pgb.Rectangle);
				pgb.MultiplyTransform (new Matrix (2, 0, 0, 2, 2, 2));
				CheckDefaultRectangle ("Multiply", pgb.Rectangle);
				pgb.ResetTransform ();
				CheckDefaultRectangle ("Reset", pgb.Rectangle);
				pgb.RotateTransform (90);
				CheckDefaultRectangle ("Rotate", pgb.Rectangle);
				pgb.ScaleTransform (4, 0.25f);
				CheckDefaultRectangle ("Scale", pgb.Rectangle);
				pgb.TranslateTransform (-10, -20);
				CheckDefaultRectangle ("Translate", pgb.Rectangle);

				pgb.SetBlendTriangularShape (0.5f);
				CheckDefaultRectangle ("SetBlendTriangularShape", pgb.Rectangle);
				pgb.SetSigmaBellShape (0.5f);
				CheckDefaultRectangle ("SetSigmaBellShape", pgb.Rectangle);
			}
		}
開發者ID:nlhepler,項目名稱:mono,代碼行數:21,代碼來源:PathGradientBrushTest.cs


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