Example #1
0
        private static VectorGraphics.Primitives.Container CreateContainer( VectorGraphics.Renderers.Renderer renderer, int width, int height, bool balloon, Drawing.ColorTable colorTable )
        {
            VectorGraphics.Paint.Color primaryColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( colorTable.PrimaryColor );
            VectorGraphics.Paint.Color lightener = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( colorTable.GlossyLightenerColor );
            VectorGraphics.Paint.Color borderColor = VectorGraphics.Paint.Color.Combine( primaryColor, lightener, 0.5 );
            VectorGraphics.Paint.Color gradientStartColor = VectorGraphics.Paint.Color.Combine( primaryColor, lightener, 0.05 );
            VectorGraphics.Paint.Color gradientEndColor = VectorGraphics.Paint.Color.Combine( primaryColor, lightener, 0.2 );

            VectorGraphics.Factories.RoundedRectangle roundRectFactory = new VectorGraphics.Factories.RoundedRectangle();
            VectorGraphics.Factories.SoftShadow softShadowFactory = new VectorGraphics.Factories.SoftShadow
                ( renderer, new VectorGraphics.Types.Point( 1, 1 ), 3, new VectorGraphics.Paint.Color( 0, 0, 0, 0.3 ) );

            VectorGraphics.Types.Rectangle mainRect = new VectorGraphics.Types.Rectangle( 0, 0, width, height );
            VectorGraphics.Primitives.Container container = new VectorGraphics.Primitives.Container();

            double radius = 3;
            VectorGraphics.Primitives.Path shape = roundRectFactory.Create( mainRect, radius );

            if( balloon )
            {
                shape = new VectorGraphics.Primitives.Path();

                shape.Add( new VectorGraphics.Primitives.Path.Move( new VectorGraphics.Types.Point( mainRect.X + radius, mainRect.Y ) ) );
                shape.Add( new VectorGraphics.Primitives.Path.Line( new VectorGraphics.Types.Point( mainRect.X + radius * 2, mainRect.Y ) ) );
                shape.Add( new VectorGraphics.Primitives.Path.Line( new VectorGraphics.Types.Point( mainRect.X - radius, mainRect.Y - radius * 7 ) ) );
                shape.Add( new VectorGraphics.Primitives.Path.Line( new VectorGraphics.Types.Point( mainRect.X + radius * 9, mainRect.Y ) ) );
                shape.Add( new VectorGraphics.Primitives.Path.Line( new VectorGraphics.Types.Point( mainRect.X + mainRect.Width - radius, mainRect.Y ) ) );
                shape.Add( new VectorGraphics.Primitives.Path.EllipticalArc( radius, radius, 0, false, true, new VectorGraphics.Types.Point( mainRect.X + mainRect.Width, mainRect.Y + radius ) ) );
                shape.Add( new VectorGraphics.Primitives.Path.Line( new VectorGraphics.Types.Point( mainRect.X + mainRect.Width, mainRect.Y + mainRect.Height - radius ) ) );
                shape.Add( new VectorGraphics.Primitives.Path.EllipticalArc( radius, radius, 0, false, true, new VectorGraphics.Types.Point( mainRect.X + mainRect.Width - radius, mainRect.Y + mainRect.Height ) ) );
                shape.Add( new VectorGraphics.Primitives.Path.Line( new VectorGraphics.Types.Point( mainRect.X + radius, mainRect.Y + mainRect.Height ) ) );
                shape.Add( new VectorGraphics.Primitives.Path.EllipticalArc( radius, radius, 0, false, true, new VectorGraphics.Types.Point( mainRect.X, mainRect.Y + mainRect.Height - radius ) ) );
                shape.Add( new VectorGraphics.Primitives.Path.Line( new VectorGraphics.Types.Point( mainRect.X, mainRect.Y + radius ) ) );
                shape.Add( new VectorGraphics.Primitives.Path.EllipticalArc( radius, radius, 0, false, true, new VectorGraphics.Types.Point( mainRect.X + radius, mainRect.Y ) ) );
                shape.Add( new VectorGraphics.Primitives.Path.Close() );
            }
            else
            {
                shape = roundRectFactory.Create( mainRect, 3 );
            }

            shape.Pen = new VectorGraphics.Paint.Pens.SolidPen( borderColor, 1 );
            shape.Brush = new VectorGraphics.Paint.Brushes.LinearGradientBrush( gradientStartColor, gradientEndColor, mainRect.TopLeft, mainRect.BottomLeft );

            container.AddBack( shape );

            softShadowFactory.Apply( container );

            return container;
        }
Example #2
0
            private VectorGraphics.Primitives.Container CreateExpandCollapseItem( VectorGraphics.Renderers.Renderer renderer, double borderGlow, double glow, bool over )
            {
                VectorGraphics.Primitives.Container container = new VectorGraphics.Primitives.Container();

                VectorGraphics.Primitives.Path arrow = new VectorGraphics.Primitives.Path( new VectorGraphics.Primitives.Path.Command[]
                    {
                        new VectorGraphics.Primitives.Path.Move( new VectorGraphics.Types.Point( -_ecSize / 4, -_ecSize / 2 ) ),
                        new VectorGraphics.Primitives.Path.Line( new VectorGraphics.Types.Point( _ecSize / 3, 0 ) ),
                        new VectorGraphics.Primitives.Path.Line( new VectorGraphics.Types.Point( -_ecSize / 4, _ecSize / 2 ) ),
                        new VectorGraphics.Primitives.Path.Close()
                    } );

                VectorGraphics.Paint.Color greyColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( _colorTable.GrayTextColor );
                VectorGraphics.Paint.Color glowDeepColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( _colorTable.GlowDeepColor );
                VectorGraphics.Paint.Color glowColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( _colorTable.GlowColor );
                VectorGraphics.Paint.Color bgColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( SystemColors.Window );

                glowColor = VectorGraphics.Paint.Color.Combine( glowColor, bgColor, 0.7 );

                VectorGraphics.Paint.Color borderColor = VectorGraphics.Paint.Color.Combine( glowDeepColor, greyColor, glow );

                arrow.Pen = new VectorGraphics.Paint.Pens.SolidPen( new VectorGraphics.Paint.Color( borderColor, borderGlow ), 1 );

                container.AddBack( arrow );

                if( glow > 0 )
                {
                    arrow.Brush = new VectorGraphics.Paint.Brushes.SolidBrush( new VectorGraphics.Paint.Color( glowColor, glow ) );

                    VectorGraphics.Factories.SoftShadow shadow = new VectorGraphics.Factories.SoftShadow
                        ( renderer, new BinaryComponents.VectorGraphics.Types.Point( 0, 0 ), 3
                        , new VectorGraphics.Paint.Color( glowColor, glow ) );

                    shadow.Apply( container );
                }

                return container;
            }