System.Drawing.Drawing2D.LinearGradientBrush.RotateTransform C# (CSharp) Method

RotateTransform() public method

public RotateTransform ( float angle ) : void
angle float
return void
        public void RotateTransform(float angle)
        {
            this.RotateTransform(angle, MatrixOrder.Prepend);
        }

Same methods

LinearGradientBrush::RotateTransform ( float angle, MatrixOrder order ) : void

Usage Example

示例#1
0
        //绘制实心菱形
        private static void DrawSolidDiamond(PointF[] p, Graphics g, Color c, Size sz)
        {
            PointF[] p2 = new PointF[5];
           
            RectangleF recf = new RectangleF(0, 0, sz.Width, sz.Height);

            LinearGradientBrush bsh = new LinearGradientBrush(recf, c, c, 0.0f);
            bsh.RotateTransform(45);

            float a = (float)Math.Sqrt(sz.Width * sz.Width + sz.Height * sz.Height);
            float halfa = a * 0.5f;

            for (int i = 0; i < p.Length; i++)
            {
                p2[0].X = p[i].X;
                p2[0].Y = p[i].Y - halfa;

                p2[1].X = p[i].X + halfa;
                p2[1].Y = p[i].Y;

                p2[2].X = p[i].X;
                p2[2].Y = p[i].Y + halfa;

                p2[3].X = p[i].X - halfa;
                p2[3].Y = p[i].Y;

                p2[4] = p2[0];
                
                g.FillPolygon(bsh, p2);
            }
        }
All Usage Examples Of System.Drawing.Drawing2D.LinearGradientBrush::RotateTransform