Ejemplo n.º 1
0
        protected double GetFade( Context context, Item item, double fadeIn, double fadeOut )
        {
            double fadeInGlow = 0, fadeOutGlow = 0;

            if( context.History != null && context.History.MouseOverItem == item )
            {
                double fadeInTime = context.History.GetTimeOverItem( item ).Value;

                if( fadeInTime < fadeIn )
                {
                    context.Updates.NeedsUpdate( item );
                    fadeInGlow = fadeInTime / fadeIn;
                }
                else
                {
                    fadeInGlow = 1;
                }
            }

            if( context.History != null )
            {
                double fadeOutTime = context.History.GetLastOverItem( item );

                if( fadeOutTime < fadeOut )
                {
                    context.Updates.NeedsUpdate( item );
                    fadeOutGlow = 1 - fadeOutTime / fadeOut;
                }
            }

            return Math.Min( Math.Max( 0, Math.Max( fadeInGlow, fadeOutGlow ) ), 1 );
        }
Ejemplo n.º 2
0
        public override void Paint( Context context, Rectangle clip, Rectangle logicalBounds )
        {
            _updates = context.Updates;

            double seconds = DateTime.Now.Subtract( _start ).TotalSeconds;

            _animation.OnPaint( context.Graphics, logicalBounds, _animating, seconds );
        }
Ejemplo n.º 3
0
        public override void PaintBackground( Context context, Rectangle clip )
        {
            VectorGraphics.Primitives.Container visualItem = CreateRibbonVisualItem( context );

            using( VectorGraphics.Renderers.GdiPlusRenderer renderer = CreateRenderer( context ) )
            {
                renderer.Render( context.Graphics, visualItem, VectorGraphics.Renderers.GdiPlusUtility.Convert.Rectangle( clip ) );
            }
        }
Ejemplo n.º 4
0
        public override void Paint( Context context, Rectangle clip, Rectangle logicalBounds )
        {
            if( logicalBounds == Rectangle.Empty )
            {
                return;
            }

            context.Renderer.PaintProgressBar( context, clip, logicalBounds, _percentage );
        }
Ejemplo n.º 5
0
        protected override bool OnClick( Context context )
        {
            Rectangle logicalBounds = context.GetItemBounds( this );
            ButtonSizeKind buttonSizeKind = IdentifyButton( logicalBounds.Size );

            if( buttonSizeKind != ButtonSizeKind.Single )
            {
                Rectangle majorBounds = GetMajorBounds( logicalBounds );
                Rectangle minorBounds = GetMinorBounds( logicalBounds );

                if( minorBounds.Contains( context.RibbonControl.PointToClient( Control.MousePosition ) ) )
                {
                    if( _contextMenuStrip != null )
                    {
                        Screen buttonScreen = Screen.PrimaryScreen;
                        Screen menuScreen = Screen.PrimaryScreen;
                        Point buttonPosn = this.Section.Ribbon.PointToScreen( logicalBounds.Location );
                        Rectangle buttonRect = new Rectangle( buttonPosn, logicalBounds.Size );

                        foreach( Screen screen in Screen.AllScreens )
                        {
                            if( screen.Bounds.Contains( buttonRect ) )
                            {
                                buttonScreen = screen;
                            }
                        }

                        int x = buttonRect.Left, y = buttonRect.Bottom;

                        if( x + _contextMenuStrip.Bounds.Width > buttonScreen.WorkingArea.Right )
                        {
                            x = buttonScreen.WorkingArea.Right - _contextMenuStrip.Bounds.Width;
                        }
                        if( y + _contextMenuStrip.Bounds.Height > buttonScreen.WorkingArea.Bottom )
                        {
                            y = buttonScreen.WorkingArea.Bottom - _contextMenuStrip.Bounds.Height;
                        }

                        Point display = context.RibbonControl.PointToClient( new Point( x, y ) );

                        _contextMenuStrip.Show( context.RibbonControl, display );

                        return true;
                    }
                }
            }

            return base.OnClick( context );
        }
Ejemplo n.º 6
0
            public override void Paint( Context context, Rectangle clip, Rectangle logicalBounds )
            {
                Renderer.BackgroundStyle backgroundStyle = Renderer.BackgroundStyle.Normal;

                if( context.History.MouseOverItem == this )
                {
                    if( logicalBounds.Contains( context.RibbonControl.PointToClient( Control.MousePosition ) ) )
                    {
                        if( Control.MouseButtons == MouseButtons.Left )
                        {
                            backgroundStyle |= Renderer.BackgroundStyle.Pressed;
                        }
                    }
                }

                context.Renderer.PaintItemBackground( context, clip, logicalBounds, this, backgroundStyle );
            }
Ejemplo n.º 7
0
        public override void Paint( Context context, Rectangle clip, Rectangle logicalBounds )
        {
            if( logicalBounds == Rectangle.Empty )
            {
                _control.Visible = false;
            }
            else
            {
                _control.Visible = true;
                _control.Bounds = logicalBounds;
                _control.Parent = context.RibbonControl;
            }

            Rectangle sectionRect = context.GetSectionBounds( Section );

            Section.Paint( context, clip, sectionRect );
        }
Ejemplo n.º 8
0
 protected virtual void PaintImage( Context context, Rectangle logicalBounds, Image image, Rectangle imageRect, bool enabled )
 {
     context.Graphics.DrawImage( image, imageRect );
 }
Ejemplo n.º 9
0
        public override void Paint( Context context, Rectangle clip, Rectangle logicalBounds )
        {
            if( logicalBounds == Rectangle.Empty )
            {
                return;
            }

            EnsureDisabledIcons( context.RibbonControl.ColorTable );

            Renderer.BackgroundStyle backgroundStyle = Renderer.BackgroundStyle.Normal;

            if( !Enabled )
            {
                backgroundStyle |= Renderer.BackgroundStyle.Disabled;
            }
            else if( context.History.MouseOverItem == this )
            {
                if( logicalBounds.Contains( context.RibbonControl.PointToClient( Control.MousePosition ) ) )
                {
                    if( Control.MouseButtons == MouseButtons.Left )
                    {
                        backgroundStyle |= Renderer.BackgroundStyle.Pressed;
                    }
                }
            }

            RectangleF textRect;
            Rectangle imageRect;
            StringAlignment lineAlignment = StringAlignment.Far, alignment = StringAlignment.Center;
            Image image = null, imageDisabled = null;
            ButtonSizeKind buttonSizeKind = IdentifyButton( logicalBounds.Size );

            PaintBackground( context, clip, logicalBounds, backgroundStyle );

            switch( buttonSizeKind )
            {
                case ButtonSizeKind.Single:
                    {
                        imageRect = new Rectangle( logicalBounds.X + 4, logicalBounds.Y + (logicalBounds.Height - 16) / 2 + 1, 16, 16 );
                        textRect = RectangleF.Empty;
                        image = _image16;
                        imageDisabled = _imageDisabled16;
                        break;
                    }
                case ButtonSizeKind.Wide:
                    {
                        if( _image16 == null )
                        {
                            imageRect = Rectangle.Empty;
                            textRect = new RectangleF( logicalBounds.X + 4, logicalBounds.Y + 1, logicalBounds.Width - 6, logicalBounds.Height - 1 );
                        }
                        else
                        {
                            imageRect = new Rectangle( logicalBounds.X + 3, logicalBounds.Y + (logicalBounds.Height - 16) / 2 + 1, 16, 16 );
                            textRect = new RectangleF( logicalBounds.X + 21, logicalBounds.Y + 1, logicalBounds.Width - 18, logicalBounds.Height - 1 );
                        }
                        alignment = StringAlignment.Near;
                        lineAlignment = StringAlignment.Center;
                        image = _image16;
                        imageDisabled = _imageDisabled16;
                        break;
                    }
                case ButtonSizeKind.Big:
                    {
                        imageRect = new Rectangle( logicalBounds.X + (logicalBounds.Width - 24) / 2, logicalBounds.Y + 3, 24, 24 );
                        textRect = new RectangleF( logicalBounds.X + 1, logicalBounds.Y + 13, logicalBounds.Width - 2, logicalBounds.Height - 14 );
                        image = _image24;
                        imageDisabled = _imageDisabled24;
                        break;
                    }
                default:
                    throw new InvalidOperationException();
            }

            int xpos = logicalBounds.X + Border;

            if( image != null )
            {
                context.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;

                if( Enabled )
                {
                    PaintImage( context, logicalBounds, image, imageRect, true );
                }
                else
                {
                    PaintImage( context, logicalBounds, imageDisabled, imageRect, false );
                }
            }

            if( _text != null && _text != string.Empty && textRect != RectangleF.Empty )
            {
                Drawing.ColorTable colorTable = context.RibbonControl.ColorTable;
                double glow = context.Renderer.GetFade( context, this );

                Color color;

                if( Enabled )
                {
                    color = WinFormsUtility.Drawing.ColorUtil.Combine( colorTable.GlowTextColor, colorTable.TextColor, glow );
                }
                else
                {
                    color = colorTable.GrayTextColor;
                }

                using( Brush brush = new SolidBrush( color ) )
                using( StringFormat sf = new StringFormat( StringFormat.GenericTypographic ) )
                {
                    sf.Alignment = alignment;
                    sf.LineAlignment = lineAlignment;

                    using( Font font = CreateFont() )
                    {
                        PaintText( context, logicalBounds, _text, font, brush, textRect, sf, Enabled );
                    }
                }
            }
        }
Ejemplo n.º 10
0
 public void PerformClick( Context context )
 {
     OnClick( context );
 }
Ejemplo n.º 11
0
        private void SetSectionFont( Context context, Section section, VectorGraphics.Primitives.Text text )
        {
            VectorGraphics.Paint.Color titleColor = GetPrimaryBackgroundColor( context, section );
            VectorGraphics.Paint.Color textColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( context.RibbonControl.ColorTable.TextColor );

            titleColor = VectorGraphics.Paint.Color.Combine( titleColor, textColor, 0.5 );

            text.FontFamily = SystemFonts.DialogFont.FontFamily.Name;
            text.FontSizePoints = SystemFonts.DialogFont.SizeInPoints;
            text.Color = titleColor;
        }
Ejemplo n.º 12
0
        private VectorGraphics.Paint.Color GetLightenerColor( Context context, Section section, double glow )
        {
            Color lightener = WinFormsUtility.Drawing.ColorUtil.Combine
                ( context.RibbonControl.ColorTable.GlossyLightenerColor, context.RibbonControl.ColorTable.GlossyGlowLightenerColor, 1 - glow );

            return VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( lightener );
        }
Ejemplo n.º 13
0
        private VectorGraphics.Primitives.Path CreateRoundRectHighlight( Context context, VectorGraphics.Types.Rectangle rect, double radius )
        {
            VectorGraphics.Primitives.Path path = new VectorGraphics.Primitives.Path();
            VectorGraphics.Paint.Color lightener = GetLightenerColor( context, null, 0 );

            path.Add( new VectorGraphics.Primitives.Path.Move( new VectorGraphics.Types.Point( rect.X, rect.Y + rect.Height - radius ) ) );
            path.Add( new VectorGraphics.Primitives.Path.Line( new VectorGraphics.Types.Point( rect.X, rect.Y + radius ) ) );
            path.Add( new VectorGraphics.Primitives.Path.EllipticalArc( radius, radius, 0, false, true, new VectorGraphics.Types.Point( rect.X + radius, rect.Y ) ) );
            path.Add( new VectorGraphics.Primitives.Path.Line( new VectorGraphics.Types.Point( rect.X + rect.Width - radius, rect.Y ) ) );

            path.Pen = new VectorGraphics.Paint.Pens.SolidPen( new VectorGraphics.Paint.Color( lightener, 0.6 ), 1 );

            return path;
        }
Ejemplo n.º 14
0
 protected VectorGraphics.Renderers.GdiPlusRenderer CreateRenderer( Context context )
 {
     return new VectorGraphics.Renderers.GdiPlusRenderer( delegate
     {
         return context.Graphics;
     }, VectorGraphics.Renderers.GdiPlusRenderer.MarkerHandling.Throw, 5.0 );
 }
Ejemplo n.º 15
0
        public override void PaintSection( Context context, Rectangle clip, Rectangle logicalBounds, Section section )
        {
            if( logicalBounds == Rectangle.Empty )
            {
                return;
            }

            VectorGraphics.Primitives.Container visualItem = CreateSectionVisualItem( context, logicalBounds, section );

            if( context.RibbonControl.Glass != null )
            {
                VectorGraphics.Factories.Transparency transparency = new VectorGraphics.Factories.Transparency();

                transparency.Apply( visualItem, 0.85 );
            }

            using( VectorGraphics.Renderers.GdiPlusRenderer renderer = CreateRenderer( context ) )
            {
                renderer.Render( context.Graphics, visualItem, VectorGraphics.Renderers.GdiPlusUtility.Convert.Rectangle( clip ) );
            }
        }
Ejemplo n.º 16
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;
        }
Ejemplo n.º 17
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;
        }
Ejemplo n.º 18
0
        protected VectorGraphics.Paint.Brushes.Brush CreateSectionBrush( Context context, Section section, double glow, VectorGraphics.Types.Rectangle rect )
        {
            VectorGraphics.Factories.GlossyBrush glossyBrushFactory = CreateGlossyBrushFactory( context, section, glow / 2 );
            VectorGraphics.Paint.Color primaryColor = GetPrimaryBackgroundColor( context, section );
            VectorGraphics.Paint.Color lightener = GetLightenerColor( context, section, 0 );

            return glossyBrushFactory.Create( VectorGraphics.Paint.Color.Combine( primaryColor, lightener, 1 - glow / 3 ), rect.Top, rect.Bottom );
        }
Ejemplo n.º 19
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;
        }
Ejemplo n.º 20
0
        protected VectorGraphics.Paint.Pens.Pen CreateSectionPen( Context context, Section section, double glow )
        {
            VectorGraphics.Paint.Color primaryColor = GetPrimaryBorderColor( context, section );
            VectorGraphics.Paint.Color lightner = GetLightenerColor( context, section, glow );

            return new VectorGraphics.Paint.Pens.SolidPen( VectorGraphics.Paint.Color.Combine( primaryColor, lightner, 0.7 - glow / 3 ), 1 );
        }
Ejemplo n.º 21
0
 private VectorGraphics.Paint.Color GetPrimaryForegroundColor( Context context, Section section )
 {
     return VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( context.RibbonControl.ColorTable.PrimaryColor );
 }
Ejemplo n.º 22
0
 public override double GetFade( Context context, Item item )
 {
     return GetFade( context, item, FadeIn, FadeOut );
 }
Ejemplo n.º 23
0
 public abstract void Paint( Context context, Rectangle clip, Rectangle logicalBounds );
Ejemplo n.º 24
0
 private VectorGraphics.Factories.GlossyBrush CreateGlossyBrushFactory( Context context, Section section, double glow )
 {
     return new VectorGraphics.Factories.GlossyBrush( GetLightenerColor( context, section, glow ) );
 }
Ejemplo n.º 25
0
 protected virtual bool OnClick( Context context )
 {
     return false;
 }
Ejemplo n.º 26
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 );
        }
Ejemplo n.º 27
0
 protected virtual void PaintBackground( Context context, Rectangle clip, Rectangle logicalBounds, Renderer.BackgroundStyle backgroundStyle )
 {
     context.Renderer.PaintItemBackground( context, clip, logicalBounds, this, backgroundStyle );
 }
Ejemplo n.º 28
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 );
        }
Ejemplo n.º 29
0
 protected virtual void PaintText( Context context, Rectangle logicalBounds, string text, Font font, Brush brush, RectangleF textRect, StringFormat sf, bool enabled )
 {
     context.Graphics.DrawString( _text, font, brush, textRect, sf );
 }
Ejemplo n.º 30
0
        private VectorGraphics.Primitives.Container CreateItemVisualItem( Context context, Rectangle logicalBounds, Item item, BackgroundStyle backgroundStyle )
        {
            double glow = item == null ? 0 : GetFade( context, item, FadeIn, FadeOut );

            if( backgroundStyle == BackgroundStyle.Disabled )
            {
                glow = 0;
            }

            return CreateItemVisualItem( context, logicalBounds, item, glow, backgroundStyle );
        }