Esempio n. 1
0
        private void DoInstructions(Single recX, Single recY, Single recWidth, Single recHeight, Brush b, Single StartAngle, Single SweepAngle)
        {
            PagePie pl = new PagePie();

            pl.StartAngle = StartAngle;
            pl.SweepAngle = SweepAngle;

            StyleInfo SI = new StyleInfo();

            pl.X = X + recX * SCALEFACTOR;
            pl.Y = Y + recY * SCALEFACTOR;
            pl.W = recWidth * SCALEFACTOR;
            pl.H = recHeight * SCALEFACTOR;

            switch (b.GetType().Name)
            {
            case "SolidBrush":
                System.Drawing.SolidBrush theBrush = (System.Drawing.SolidBrush)b;
                SI.Color           = theBrush.Color;
                SI.BackgroundColor = theBrush.Color;
                break;

            case "LinearGradientBrush":
                System.Drawing.Drawing2D.LinearGradientBrush linBrush = (System.Drawing.Drawing2D.LinearGradientBrush)b;
                SI.BackgroundGradientType     = BackgroundGradientTypeEnum.LeftRight;
                SI.BackgroundColor            = linBrush.LinearColors[0];
                SI.BackgroundGradientEndColor = linBrush.LinearColors[1];
                break;

            case "HatchBrush":
                System.Drawing.Drawing2D.HatchBrush hatBrush = (System.Drawing.Drawing2D.HatchBrush)b;
                SI.BackgroundColor = hatBrush.BackgroundColor;
                SI.Color           = hatBrush.ForegroundColor;

                SI.PatternType = StyleInfo.GetPatternType(hatBrush.HatchStyle);
                break;

            default:
                break;
            }

            pl.SI = SI;
            items.Add(pl);
        }
Esempio n. 2
0
        private void DoInstructions(PointF[] Ps, Brush b)
        {
            PagePolygon pl = new PagePolygon();

            //pl.X = X * SCALEFACTOR;
            //pl.Y = Y * SCALEFACTOR;
            pl.Points = Ps;
            StyleInfo SI = new StyleInfo();

            switch (b.GetType().Name)
            {
            case "SolidBrush":
                System.Drawing.SolidBrush theBrush = (System.Drawing.SolidBrush)b;
                SI.Color           = theBrush.Color;
                SI.BackgroundColor = theBrush.Color;
                break;

            case "LinearGradientBrush":
                System.Drawing.Drawing2D.LinearGradientBrush linBrush = (System.Drawing.Drawing2D.LinearGradientBrush)b;
                SI.BackgroundGradientType     = BackgroundGradientTypeEnum.LeftRight;
                SI.BackgroundColor            = linBrush.LinearColors[0];
                SI.BackgroundGradientEndColor = linBrush.LinearColors[1];
                break;

            case "HatchBrush":
                System.Drawing.Drawing2D.HatchBrush hatBrush = (System.Drawing.Drawing2D.HatchBrush)b;
                SI.BackgroundColor = hatBrush.BackgroundColor;
                SI.Color           = hatBrush.ForegroundColor;
                SI.PatternType     = StyleInfo.GetPatternType(hatBrush.HatchStyle);
                break;

            default:
                break;
            }

            pl.SI = SI;
            items.Add(pl);
        }