Пример #1
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;
        }
Пример #2
0
        private VectorGraphics.Paint.Brushes.Brush CreateItemBrush( Context context, Item item, double glow, double overGlow, VectorGraphics.Types.Rectangle rect, BackgroundStyle backgroundStyle )
        {
            VectorGraphics.Factories.GlossyBrush glossyBrushFactory = CreateGlossyBrushFactory( context, glow );
            VectorGraphics.Paint.Color primaryColor = GetPrimaryBackgroundColor( context, item == null ? null : item.Section );
            VectorGraphics.Paint.Color glowStartColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( context.RibbonControl.ColorTable.GlowColor );
            VectorGraphics.Paint.Color glowEndColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( context.RibbonControl.ColorTable.GlowHighlightColor );

            if( backgroundStyle == BackgroundStyle.Disabled )
            {
                primaryColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( context.RibbonControl.ColorTable.GrayPrimaryBackgroundColor );
                glowEndColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( context.RibbonControl.ColorTable.GrayPrimaryBackgroundColor );
            }
            else
            {
                if( (backgroundStyle & BackgroundStyle.Pressed) != 0 )
                {
                    glowStartColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( context.RibbonControl.ColorTable.GlowDeepColor );
                    glowEndColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( context.RibbonControl.ColorTable.GlowDeepColor );
                }
            }

            VectorGraphics.Paint.Color lightener = GetLightenerColor( context, null, glow );
            VectorGraphics.Paint.Color primaryEnd = VectorGraphics.Paint.Color.Combine( primaryColor, lightener, 0.6 );

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

            return glossyBrushFactory.Create
                ( VectorGraphics.Paint.Color.Combine( primaryColor, glowStartColor, 1 - glow )
                , VectorGraphics.Paint.Color.Combine( primaryEnd, glowEndColor, 1 - glow )
                , rect.Top, rect.Bottom );
        }
Пример #3
0
        private VectorGraphics.Paint.Pens.Pen CreateItemPen( Context context, Item item, double glow, double overGlow, BackgroundStyle backgroundStyle )
        {
            VectorGraphics.Paint.Color primaryColor = GetPrimaryForegroundColor( context, item == null ? null : item.Section );
            VectorGraphics.Paint.Color glowColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( context.RibbonControl.ColorTable.GlowColor );

            primaryColor = VectorGraphics.Paint.Color.Combine( primaryColor, VectorGraphics.Paint.Color.White, 0.7 );

            if( backgroundStyle == BackgroundStyle.Disabled )
            {
                primaryColor = VectorGraphics.Paint.Color.Combine( primaryColor, VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( context.RibbonControl.ColorTable.GrayBackgroundColor ), 0.2 );
            }
            else
            {
                if( (backgroundStyle & BackgroundStyle.Pressed) != 0 )
                {
                    glowColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( context.RibbonControl.ColorTable.GlowDeepColor );
                }
            }

            primaryColor = new VectorGraphics.Paint.Color( primaryColor, overGlow );
            glowColor = new VectorGraphics.Paint.Color( glowColor, overGlow );

            return new VectorGraphics.Paint.Pens.SolidPen( VectorGraphics.Paint.Color.Combine( primaryColor, glowColor, 1 - glow ), 1 );
        }
Пример #4
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;
            }