Beispiel #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;
        }
Beispiel #2
0
        private VectorGraphics.Primitives.Container CreateSectionVisualItem( Context context, Rectangle logicalBounds, Section section )
        {
            double glow = GetFade( context, logicalBounds, section, FadeIn, FadeOut );
            VectorGraphics.Types.Rectangle rect = VectorGraphics.Renderers.GdiPlusUtility.Convert.Rectangle( logicalBounds );
            VectorGraphics.Factories.RoundedRectangle roundedRectangleFactory = new VectorGraphics.Factories.RoundedRectangle();

            VectorGraphics.Primitives.Container container = new VectorGraphics.Primitives.Container();

            VectorGraphics.Primitives.Path roundedRect = roundedRectangleFactory.Create( rect, 3 );

            roundedRect.Pen = CreateSectionPen( context, section, glow );
            roundedRect.Brush = CreateSectionBrush( context, section, glow, rect );

            container.AddBack( roundedRect );

            VectorGraphics.Primitives.Path roundRectHighlight =
                CreateRoundRectHighlight( context, new VectorGraphics.Types.Rectangle( rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 2 ), 2 );

            container.AddBack( roundRectHighlight );

            double textHeight = WinFormsUtility.Drawing.GdiPlusEx.MeasureString( context.Graphics, section.Title, SystemFonts.DialogFont, int.MaxValue ).Height;
            VectorGraphics.Primitives.Path titleBackground = roundedRectangleFactory.Create
                ( new VectorGraphics.Types.Rectangle( rect.X, rect.Bottom - textHeight - 2, rect.Width, textHeight + 1 ), 2
                , VectorGraphics.Factories.RoundedRectangle.Corners.BottomLeft | VectorGraphics.Factories.RoundedRectangle.Corners.BottomRight );
            VectorGraphics.Paint.Color titleColor = GetPrimaryBackgroundColor( context, section );
            VectorGraphics.Paint.Color lightener = GetLightenerColor( context, section, glow );

            titleColor = VectorGraphics.Paint.Color.Combine( titleColor, lightener, 1 - glow / 7 );

            titleBackground.Pen = null;
            titleBackground.Brush = new VectorGraphics.Paint.Brushes.SolidBrush( titleColor );

            container.AddBack( titleBackground );

            VectorGraphics.Primitives.Text text = new VectorGraphics.Primitives.Text
                ( section.Title, new VectorGraphics.Types.Point( rect.X + rect.Width / 2 + 1, rect.Bottom - 2 ), VectorGraphics.Primitives.Text.Position.BottomCenter );

            SetSectionFont( context, section, text );

            container.AddBack( text );

            return container;
        }
Beispiel #3
0
        private VectorGraphics.Primitives.Container CreateRibbonVisualItem( Context context )
        {
            Rectangle clientRect = new Rectangle
                ( context.RibbonControl.ClientRectangle.X, context.RibbonControl.ClientRectangle.Y
                , context.RibbonControl.ClientRectangle.Width - 1, context.RibbonControl.ClientRectangle.Height - 1 );
            VectorGraphics.Types.Rectangle rect = VectorGraphics.Renderers.GdiPlusUtility.Convert.Rectangle( clientRect );
            VectorGraphics.Factories.RoundedRectangle roundedRectangleFactory = new VectorGraphics.Factories.RoundedRectangle();

            VectorGraphics.Primitives.Container container = new VectorGraphics.Primitives.Container();

            VectorGraphics.Primitives.Path roundedRect = roundedRectangleFactory.Create( rect, 3 );

            roundedRect.Pen = CreateSectionPen( context, null, 0 );
            roundedRect.Brush = CreateSectionBrush( context, null, 0, rect );

            container.AddBack( roundedRect );

            VectorGraphics.Primitives.Path roundRectHighlight =
                CreateRoundRectHighlight( context, new VectorGraphics.Types.Rectangle( rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 2 ), 2 );

            container.AddBack( roundRectHighlight );

            return container;
        }
Beispiel #4
0
        private VectorGraphics.Primitives.Container CreateItemVisualItem( Context context, Rectangle logicalBounds, Item item, double glow, BackgroundStyle backgroundStyle )
        {
            double overGlow = glow;

            if( logicalBounds.Height == RowHeight )
            {
                overGlow = 1;
            }

            VectorGraphics.Types.Rectangle rect = VectorGraphics.Renderers.GdiPlusUtility.Convert.Rectangle( logicalBounds );
            VectorGraphics.Factories.RoundedRectangle roundedRectangleFactory = new VectorGraphics.Factories.RoundedRectangle();

            VectorGraphics.Primitives.Container container = new VectorGraphics.Primitives.Container();

            VectorGraphics.Primitives.Path roundedRect = roundedRectangleFactory.Create( rect, 3 );

            roundedRect.Pen = CreateItemPen( context, item, glow, overGlow, backgroundStyle );
            roundedRect.Brush = CreateItemBrush( context, item, glow, overGlow, rect, backgroundStyle );

            container.AddBack( roundedRect );

            VectorGraphics.Primitives.Path lightRoundedRect = roundedRectangleFactory.Create
                ( new VectorGraphics.Types.Rectangle( rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 2 ), 2 );
            VectorGraphics.Paint.Color lightener = GetLightenerColor( context, null, glow );

            lightRoundedRect.Pen = new VectorGraphics.Paint.Pens.SolidPen( new VectorGraphics.Paint.Color( lightener, 0.4 * overGlow ), 1 );
            lightRoundedRect.Brush = null;

            container.AddBack( lightRoundedRect );

            if( glow > 0 )
            {
                VectorGraphics.Primitives.Path glowRoundedRect = roundedRectangleFactory.Create
                    ( new VectorGraphics.Types.Rectangle( rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2 ), 4 );
                VectorGraphics.Paint.Color glowEndColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( context.RibbonControl.ColorTable.GlowHighlightColor );

                glowEndColor = new VectorGraphics.Paint.Color( glowEndColor, overGlow );

                glowRoundedRect.Pen = new VectorGraphics.Paint.Pens.SolidPen
                    ( new VectorGraphics.Paint.Color( glowEndColor.Red, glowEndColor.Green, glowEndColor.Blue, glow / 2 ), 1 );
                glowRoundedRect.Brush = null;

                container.AddBack( glowRoundedRect );
            }

            return container;
        }
Beispiel #5
0
            private VectorGraphics.Primitives.Container CreateRowVisualItem( Rectangle bounds, double glow )
            {
                VectorGraphics.Types.Rectangle rect = VectorGraphics.Renderers.GdiPlusUtility.Convert.Rectangle( bounds );
                VectorGraphics.Factories.RoundedRectangle roundedRectangleFactory = new VectorGraphics.Factories.RoundedRectangle();

                VectorGraphics.Primitives.Container container = new VectorGraphics.Primitives.Container();

                VectorGraphics.Primitives.Path roundedRect = roundedRectangleFactory.Create( rect, 3 );

                container.AddBack( roundedRect );

                return container;
            }
Beispiel #6
0
            private VectorGraphics.Primitives.Container CreateNodeItem( VectorGraphics.Renderers.Renderer renderer, Rectangle nodeRect, bool isSelected, double glow )
            {
                VectorGraphics.Paint.Color glowHighlightColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( _colorTable.GlowHighlightColor );
                VectorGraphics.Paint.Color glossyGlowLightenerColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( _colorTable.GlossyGlowLightenerColor );
                VectorGraphics.Paint.Color glowColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( _colorTable.GlowColor );
                VectorGraphics.Paint.Color white = VectorGraphics.Paint.Color.White;

                VectorGraphics.Factories.RoundedRectangle roundedRectangleFactory = new VectorGraphics.Factories.RoundedRectangle();
                VectorGraphics.Factories.GlossyBrush glossyBrushFactory = new VectorGraphics.Factories.GlossyBrush( glossyGlowLightenerColor );

                VectorGraphics.Primitives.Container container = new VectorGraphics.Primitives.Container();

                VectorGraphics.Types.Rectangle rect = VectorGraphics.Renderers.GdiPlusUtility.Convert.Rectangle( nodeRect );

                VectorGraphics.Primitives.Path roundedRect = roundedRectangleFactory.Create( rect, 3 );

                container.AddBack( roundedRect );

                if( isSelected )
                {
                    VectorGraphics.Paint.Color borderColor = glowColor;
                    VectorGraphics.Paint.Color glowStartColor = glowColor;
                    VectorGraphics.Paint.Color glowEndColor = glowHighlightColor;

                    if( !_treeControl.Focused )
                    {
                        borderColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( _colorTable.GrayForegroundColor );
                        glowStartColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( _colorTable.GrayForegroundColor );
                        glowEndColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( _colorTable.GrayBackgroundColor );
                    }

                    roundedRect.Pen = new VectorGraphics.Paint.Pens.SolidPen( borderColor, 1 );
                    roundedRect.Brush = glossyBrushFactory.Create( glowStartColor, glowEndColor, nodeRect.Top, nodeRect.Bottom );

                    rect = VectorGraphics.Types.Rectangle.Shrink( rect, 1 );

                    container.AddBack( CreateRoundRectHighlight( rect, 2 ) );
                }
                else if( glow > 0 )
                {
                    VectorGraphics.Paint.Color borderColor = glowHighlightColor;
                    VectorGraphics.Paint.Color glowStartColor = glowColor;
                    VectorGraphics.Paint.Color glowEndColor = glowHighlightColor;

                    borderColor = VectorGraphics.Paint.Color.Combine( borderColor, white, 0.7 );
                    glowStartColor = VectorGraphics.Paint.Color.Combine( glowStartColor, white, 0.4 );
                    glowEndColor = VectorGraphics.Paint.Color.Combine( glowEndColor, white, 0.4 );

                    borderColor = new VectorGraphics.Paint.Color( borderColor, glow );
                    glowStartColor = new VectorGraphics.Paint.Color( glowStartColor, glow );
                    glowEndColor = new VectorGraphics.Paint.Color( glowEndColor, glow );

                    roundedRect.Pen = new VectorGraphics.Paint.Pens.SolidPen( borderColor, 1 );
                    roundedRect.Brush = glossyBrushFactory.Create( glowStartColor, glowEndColor, nodeRect.Top, nodeRect.Bottom );
                }

                return container;
            }