コード例 #1
0
        /// <summary>
        /// Perform drawing of a separator glyph.
        /// </summary>
        /// <param name="context">Render context.</param>
        /// <param name="displayRect">Display area available for drawing.</param>
        /// <param name="paletteBack">Background palette details.</param>
        /// <param name="paletteBorder">Border palette details.</param>
        /// <param name="orientation">Visual orientation of the content.</param>
        /// <param name="state">State associated with rendering.</param>
        /// <param name="canMove">Can the separator be moved.</param>
        public override void DrawSeparator(RenderContext context,
                                           Rectangle displayRect,
                                           IPaletteBack paletteBack,
                                           IPaletteBorder paletteBorder,
                                           Orientation orientation,
                                           PaletteState state,
                                           bool canMove)
        {
            // Let base class perform standard processing
            base.DrawSeparator(context,
                               displayRect,
                               paletteBack,
                               paletteBorder,
                               orientation,
                               state,
                               canMove);

            // If we are drawing the background then draw grab handles on top
            if (paletteBack.GetBackDraw(state) == InheritBool.True)
            {
                // Only draw grab handle if the user can move the separator
                if (canMove)
                    DrawGrabHandleGlyph(context, displayRect, orientation, state);
            }
        }
コード例 #2
0
 /// <summary>
 /// Initialize a new instance of the ViewDrawForm class.
 /// </summary>
 /// <param name="paletteBack">Palette source for the background.</param>		
 /// <param name="paletteBorder">Palette source for the border.</param>
 public ViewDrawForm(IPaletteBack paletteBack,
                     IPaletteBorder paletteBorder)
     : base(paletteBack, paletteBorder)
 {
     // Create a status strip we can position for rendering
     _renderStrip = new StatusStrip();
 }
コード例 #3
0
 /// <summary>
 /// Initialize a new instance of the ViewDrawRibbonAppMenu class.
 /// </summary>
 /// <param name="paletteBack">Palette source for the background.</param>		
 /// <param name="paletteBorder">Palette source for the border.</param>
 /// <param name="fixedElement">Element to display at provided screen rect.</param>
 /// <param name="fixedScreenRect">Screen rectangle for showing the element at.</param>
 public ViewDrawRibbonAppMenu(IPaletteBack paletteBack,
                              IPaletteBorder paletteBorder,
                              ViewBase fixedElement,
                              Rectangle fixedScreenRect)
     : base(paletteBack, paletteBorder)
 {
     _fixedElement = fixedElement;
     _fixedScreenRect = fixedScreenRect;
 }
コード例 #4
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawDocker class.
        /// </summary>
        /// <param name="paletteBack">Palette source for the background.</param>		
        /// <param name="paletteBorder">Palette source for the border.</param>
        /// <param name="paletteMetric">Palette source for metrics.</param>
        /// <param name="metricOverlay">Metric to use for border overlay.</param>
        public ViewDrawDocker(IPaletteBack paletteBack,
							  IPaletteBorder paletteBorder,
							  IPaletteMetric paletteMetric,
                              PaletteMetricBool metricOverlay)
            : this(paletteBack, paletteBorder,
                   paletteMetric, metricOverlay,
                   PaletteMetricPadding.None, VisualOrientation.Top)
        {
        }
コード例 #5
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawMenuImageCanvas class.
        /// </summary>
        /// <param name="paletteBack">Palette source for the background.</param>		
        /// <param name="paletteBorder">Palette source for the border.</param>
        /// <param name="columnIndex">Menu item column index.</param>
        /// <param name="zeroHeight">Should the height be forced to zero.</param>
        public ViewDrawMenuImageCanvas(IPaletteBack paletteBack,
							           IPaletteBorder paletteBorder,
                                       int columnIndex,
                                       bool zeroHeight)
            : base(paletteBack, paletteBorder, VisualOrientation.Top)
        {
            _columnIndex = columnIndex;
            _overridePreferredWidth = 0;
            _zeroHeight = zeroHeight;
        }
コード例 #6
0
ファイル: ViewDrawCanvas.cs プロジェクト: Cocotteseb/Krypton
        /// <summary>
        /// Initialize a new instance of the ViewDrawCanvas class.
        /// </summary>
        /// <param name="paletteBack">Palette source for the background.</param>		
        /// <param name="paletteBorder">Palette source for the border.</param>
        /// <param name="orientation">Visual orientation of the content.</param>
        public ViewDrawCanvas(IPaletteBack paletteBack,
							  IPaletteBorder paletteBorder,
							  VisualOrientation orientation)
            : this(paletteBack, 
                   paletteBorder, 
                   null, 
                   PaletteMetricPadding.HeaderGroupPaddingPrimary, 
                   orientation)
        {
        }
コード例 #7
0
        /// <summary>
        /// Initialize a new instance of the PaletteBorderInheritForced class.
        /// </summary>
        /// <param name="inherit">Border palette to inherit from.</param>
        public PaletteBorderInheritForced(IPaletteBorder inherit)
        {
            // Remember inheritance border
            _inherit = inherit;

            // Default values
            _maxBorderEdges = PaletteDrawBorders.All;
            _forceGraphicsHint = PaletteGraphicsHint.Inherit;
            _borderIgnoreNormal = false;
        }
コード例 #8
0
        /// <summary>
        /// Initialize a new instance of the PaletteBorder class.
        /// </summary>
        /// <param name="inherit">Source for inheriting defaulted values.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public PaletteBorder(IPaletteBorder inherit,
                             NeedPaintHandler needPaint)
        {
            Debug.Assert(inherit != null);

            // Remember inheritance
            _inherit = inherit;

            // Store the provided paint notification delegate
            NeedPaint = needPaint;
        }
コード例 #9
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonKeyTip class.
        /// </summary>
        /// <param name="keyTipInfo">Key tip information to display.</param>
        /// <param name="paletteBack">Background palette for appearance.</param>
        /// <param name="paletteBorder">Border palette for appearance.</param>
        /// <param name="paletteContent">Content palette for appearance.</param>
        public ViewDrawRibbonKeyTip(KeyTipInfo keyTipInfo,
                                    IPaletteBack paletteBack,
                                    IPaletteBorder paletteBorder,
                                    IPaletteContent paletteContent)
            : base(paletteBack, paletteBorder)
        {
            _keyTipInfo = keyTipInfo;

            // Create view for the key tip text
            _drawContent = new ViewDrawContent(paletteContent, this, VisualOrientation.Top);

            // Add content as filler for ourself
            Add(_drawContent, ViewDockStyle.Fill);
        }
コード例 #10
0
        /// <summary>
        /// Initialize a new instance of the PaletteBorderInheritOverride class.
        /// </summary>
        /// <param name="primary">First choice inheritence.</param>
        /// <param name="backup">Backup inheritence.</param>
        public PaletteBorderInheritOverride(IPaletteBorder primary,
										    IPaletteBorder backup)
        {
            Debug.Assert(primary != null);
            Debug.Assert(backup != null);

            // Store incoming alternatives
            _primary = primary;
            _backup = backup;

            // Default other state
            _apply = true;
            _override = true;
            _state = PaletteState.Normal;
        }
コード例 #11
0
        /// <summary>
        /// Initialize a new instance of the PaletteBorderEdge class.
        /// </summary>
        /// <param name="inherit">Source for inheriting defaulted values.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public PaletteBorderEdgeRedirect(IPaletteBorder inherit,
                                         NeedPaintHandler needPaint)
            : base(null, needPaint)
        {
            // Remember inheritance
            _inherit = inherit;

            // Default properties
            _borderWidth = -1;

            // Create the helper object that passes background
            // requests from the base clas and converts them into
            // border requests on ourself.
            _translate = new BackToBorder(this);
            SetInherit(_translate);
        }
コード例 #12
0
ファイル: ViewDrawCanvas.cs プロジェクト: Cocotteseb/Krypton
        /// <summary>
        /// Initialize a new instance of the ViewDrawCanvas class.
        /// </summary>
        /// <param name="paletteBack">Palette source for the background.</param>		
        /// <param name="paletteBorder">Palette source for the border.</param>
        /// <param name="paletteMetric">Palette source for metric values.</param>
        /// <param name="metricPadding">Matric used to get padding values.</param>
        /// <param name="orientation">Visual orientation of the content.</param>
        public ViewDrawCanvas(IPaletteBack paletteBack,
							  IPaletteBorder paletteBorder,
							  IPaletteMetric paletteMetric,
							  PaletteMetricPadding metricPadding,
							  VisualOrientation orientation)
        {
            // Cache the starting values
            _paletteBorder = paletteBorder;
            _paletteBack = paletteBack;
            _paletteMetric = paletteMetric;
            _metricPadding = metricPadding;
            _orientation = orientation;
            _includeBorderEdge = orientation;
            _applyIncludeBorderEdge = false;
            _drawTabBorder = false;
            _drawCanvas = true;
        }
コード例 #13
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawSplitCanvas class.
        /// </summary>
        /// <param name="paletteBack">Palette source for the background.</param>		
        /// <param name="paletteBorder">Palette source for the border.</param>
        /// <param name="paletteMetric">Palette source for metric values.</param>
        /// <param name="metricPadding">Matric used to get padding values.</param>
        /// <param name="orientation">Visual orientation of the content.</param>
        public ViewDrawSplitCanvas(IPaletteBack paletteBack,
							       IPaletteBorder paletteBorder,
							       IPaletteMetric paletteMetric,
							       PaletteMetricPadding metricPadding,
							       VisualOrientation orientation)
        {
            // Cache the starting values
            _paletteBorder = paletteBorder;
            _paletteBack = paletteBack;
            _paletteBackDraw = new PaletteBackInheritForced(_paletteBack);
            _paletteBackDraw.ForceDraw = InheritBool.True;
            _paletteBackLight = new PaletteBackLightenColors(_paletteBack);
            _paletteMetric = paletteMetric;
            _paletteBorderNormal = paletteBorder;
            _paletteBackNormal = paletteBack;
            _metricPadding = metricPadding;
            _orientation = orientation;
            _drawTabBorder = false;
            _drawCanvas = true;
            _splitter = false;
        }
コード例 #14
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupButtonBackBorder class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="groupItem">Reference to owning group item.</param>
        /// <param name="paletteBack">Palette to use for the background.</param>
        /// <param name="paletteBorder">Palette to use for the border.</param>
        /// <param name="constantBorder">Should the border be a constant normal state.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroupButtonBackBorder(KryptonRibbon ribbon,
                                                   KryptonRibbonGroupItem groupItem,
                                                   IPaletteBack paletteBack,
                                                   IPaletteBorder paletteBorder,
                                                   bool constantBorder,
                                                   NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(groupItem != null);
            Debug.Assert(paletteBack != null);
            Debug.Assert(paletteBorder != null);

            // Remember incoming references
            _ribbon = ribbon;
            _groupItem = groupItem;
            _paletteBack = paletteBack;
            _paletteBackDraw = new PaletteBackInheritForced(paletteBack);
            _paletteBackDraw.ForceDraw = InheritBool.True;
            _paletteBackLight = new PaletteBackLightenColors(paletteBack);
            _paletteBorderAll = new PaletteBorderInheritForced(paletteBorder);
            _paletteBorderAll.ForceBorderEdges(PaletteDrawBorders.All);
            _paletteBorder = paletteBorder;
            _constantBorder = constantBorder;

            // Default other fields
            _checked = false;
            _drawNonTrackingAreas = true;

            // Create delegate used to process end of click action
            _finishDelegate = new EventHandler(ActionFinished);

            // Attach a controller to this element for the pressing of the button
            _controller = new GroupButtonController(_ribbon, this, needPaint);
            _controller.Click += new EventHandler(OnClick);
            _controller.ContextClick += new MouseEventHandler(OnContextClick);
            _controller.DropDown += new EventHandler(OnDropDown);
            MouseController = _controller;
            SourceController = _controller;
            KeyController = _controller;
        }
コード例 #15
0
        /// <summary>
        /// Gets the graphics drawing hint for the border.
        /// </summary>
        /// <param name="style">Border style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>PaletteGraphicsHint value.</returns>
        public override PaletteGraphicsHint GetBorderGraphicsHint(PaletteBorderStyle style, PaletteState state)
        {
            IPaletteBorder inherit = GetInherit(state);

            return(inherit?.GetBorderGraphicsHint(state) ?? Target.GetBorderGraphicsHint(style, state));
        }
コード例 #16
0
 private void DrawBorder(IPaletteBorder paletteBorder,
                         RenderContext context,
                         Rectangle rect,
                         PaletteState state)
 {
     // Do we need to draw the border?
     if (paletteBorder.GetBorderDraw(state) == InheritBool.True)
         context.Renderer.RenderStandardBorder.DrawBorder(context, rect, paletteBorder,
                                                          VisualOrientation.Top, state);
 }
コード例 #17
0
 /// <summary>
 /// Sets the inheritence parent.
 /// </summary>
 public void SetInherit(IPaletteBorder inherit)
 {
     _inherit = inherit;
 }
コード例 #18
0
ファイル: ViewDrawCanvas.cs プロジェクト: Cocotteseb/Krypton
        /// <summary>
        /// Update the source palettes for drawing.
        /// </summary>
        /// <param name="paletteBack">Palette source for the background.</param>		
        /// <param name="paletteBorder">Palette source for the border.</param>
        /// <param name="paletteMetric">Palette source for the metric.</param>
        public virtual void SetPalettes(IPaletteBack paletteBack, 
                                        IPaletteBorder paletteBorder,
                                        IPaletteMetric paletteMetric)
        {
            Debug.Assert(paletteBorder != null);
            Debug.Assert(paletteBack != null);

            // Use newly provided palettes
            _paletteBack = paletteBack;

            // If not using a forced override decorator, then just store the new border palette
            // otherwise we update the decorator with the palette as the new inheritance to use
            if (_borderForced == null)
                _paletteBorder = paletteBorder;
            else
                _borderForced.SetInherit(paletteBorder);

            _paletteMetric = paletteMetric;
        }
コード例 #19
0
 /// <summary>
 /// Update the source palettes for drawing.
 /// </summary>
 /// <param name="paletteBack">Palette source for the background.</param>
 /// <param name="paletteBorder">Palette source for the border.</param>
 public virtual void SetPalettes(IPaletteBack paletteBack,
                                 IPaletteBorder paletteBorder)
 {
     SetPalettes(paletteBack, paletteBorder, null);
 }
コード例 #20
0
        private void DrawBackground(RenderContext context, 
                                    Rectangle rect, 
                                    IPaletteBack paletteBack, 
                                    IPaletteBorder paletteBorder,
                                    PaletteState state)
        {
            GraphicsPath borderPath;
            Padding borderPadding;

            // Ask the border renderer for a path that encloses the border
            if (DrawTabBorder)
            {
                borderPath = context.Renderer.RenderTabBorder.GetTabBackPath(context, rect, paletteBorder, Orientation, state, TabBorderStyle);
                borderPadding = Padding.Empty;
            }
            else
            {
                borderPath = context.Renderer.RenderStandardBorder.GetBackPath(context, rect, paletteBorder, Orientation, state);
                borderPadding = context.Renderer.RenderStandardBorder.GetBorderRawPadding(paletteBorder, state, Orientation);
            }

            // Apply the padding depending on the orientation
            Rectangle enclosingRect = CommonHelper.ApplyPadding(_orientation, rect, borderPadding);

            // Render the background inside the border path
            _mementoBack = context.Renderer.RenderStandardBack.DrawBack(context, enclosingRect, borderPath, paletteBack, _orientation, state, _mementoBack);

            borderPath.Dispose();
        }
コード例 #21
0
 /// <summary>
 /// Initialize a new instance of the PaletteRedirectBorder class.
 /// </summary>
 /// <param name="target">Initial palette target for redirection.</param>
 /// <param name="disabled">Redirection for disabled state requests.</param>
 /// <param name="normal">Redirection for normal state requests.</param>
 public PaletteRedirectBorder(IPalette target,
                              IPaletteBorder disabled,
                              IPaletteBorder normal)
     : this(target, disabled, normal, null, null, null, null, null, null, null)
 {
 }
コード例 #22
0
ファイル: RenderStandard.cs プロジェクト: Cocotteseb/Krypton
        /// <summary>
        /// Gets the padding used to position display elements completely inside border drawing.
        /// </summary>
        /// <param name="context">View layout context.</param>
        /// <param name="palette">Palette used for drawing.</param>
        /// <param name="state">State associated with rendering.</param>
        /// <param name="orientation">Visual orientation of the border.</param>
        /// <param name="tabBorderStyle">Style of tab border.</param>
        /// <returns>Padding structure detailing all four edges.</returns>
        public override Padding GetTabBorderDisplayPadding(ViewLayoutContext context,
                                                           IPaletteBorder palette,
                                                           PaletteState state,
                                                           VisualOrientation orientation,
                                                           TabBorderStyle tabBorderStyle)
        {
            Debug.Assert(palette != null);

            // Validate parameter reference
            if (palette == null) throw new ArgumentNullException("palette");

            // Get the width of the border
            int borderWidth = palette.GetBorderWidth(state);

            // Cache the right to left setting
            bool rtl = (context.Control.RightToLeft == RightToLeft.Yes);

            Padding ret = Padding.Empty;

            switch (tabBorderStyle)
            {
                case TabBorderStyle.DockEqual:
                case TabBorderStyle.SquareEqualMedium:
                case TabBorderStyle.SquareEqualSmall:
                case TabBorderStyle.SquareEqualLarge:
                case TabBorderStyle.RoundedEqualMedium:
                case TabBorderStyle.RoundedEqualSmall:
                case TabBorderStyle.RoundedEqualLarge:
                    ret = new Padding(borderWidth, borderWidth, borderWidth, 0);
                    break;
                case TabBorderStyle.DockOutsize:
                    ret = new Padding(borderWidth + _spacingTabDockOutsize, borderWidth + _spacingTabSquareOutsizeLarge, borderWidth + _spacingTabDockOutsize, 0);
                    break;
                case TabBorderStyle.SquareOutsizeMedium:
                case TabBorderStyle.SquareOutsizeSmall:
                case TabBorderStyle.SquareOutsizeLarge:
                case TabBorderStyle.RoundedOutsizeMedium:
                case TabBorderStyle.RoundedOutsizeSmall:
                case TabBorderStyle.RoundedOutsizeLarge:
                    ret = new Padding(borderWidth + _spacingTabOutsizePadding, borderWidth + _spacingTabOutsizePadding, borderWidth + _spacingTabOutsizePadding, 0);
                    break;
                case TabBorderStyle.SlantEqualNear:
                case TabBorderStyle.SlantOutsizeNear:
                    // Calculte the extra needed for the outsize variant
                    int x = (tabBorderStyle == TabBorderStyle.SlantOutsizeNear ? _spacingTabOutsizePadding : 0);

                    switch(orientation)
                    {
                        case VisualOrientation.Top:
                            if (rtl)
                                ret = new Padding(borderWidth + x, borderWidth + x, borderWidth + x + _spacingTabSlantPadding - 1, 0);
                            else
                                ret = new Padding(borderWidth + x + _spacingTabSlantPadding - 1, borderWidth + x, borderWidth + x, 0);
                            break;
                        case VisualOrientation.Left:
                            ret = new Padding(borderWidth + x + _spacingTabSlantPadding - 1, borderWidth + x, borderWidth + x, 0);
                            break;
                        case VisualOrientation.Right:
                            ret = new Padding(borderWidth + x, borderWidth + x, borderWidth + x + _spacingTabSlantPadding - 1, 0);
                            break;
                        case VisualOrientation.Bottom:
                            if (rtl)
                                ret = new Padding(borderWidth + x + _spacingTabSlantPadding - 1, borderWidth + x, borderWidth + x, 0);
                            else
                                ret = new Padding(borderWidth + x, borderWidth + x, borderWidth + x + _spacingTabSlantPadding - 1, 0);
                            break;
                    }
                    break;
                case TabBorderStyle.SlantEqualFar:
                case TabBorderStyle.SlantOutsizeFar:
                    // Calculte the extra needed for the outsize variant
                    int y = (tabBorderStyle == TabBorderStyle.SlantOutsizeFar ? _spacingTabOutsizePadding : 0);

                    switch (orientation)
                    {
                        case VisualOrientation.Top:
                            if (rtl)
                                ret = new Padding(borderWidth + y + _spacingTabSlantPadding - 1, borderWidth + y, borderWidth + y, 0);
                            else
                                ret = new Padding(borderWidth + y, borderWidth + y, borderWidth + y + _spacingTabSlantPadding - 1, 0);
                            break;
                        case VisualOrientation.Left:
                            ret = new Padding(borderWidth + y, borderWidth + y, borderWidth + y + _spacingTabSlantPadding - 1, 0);
                            break;
                        case VisualOrientation.Right:
                            ret = new Padding(borderWidth + y + _spacingTabSlantPadding - 1, borderWidth + y, borderWidth + y, 0);
                            break;
                        case VisualOrientation.Bottom:
                            if (rtl)
                                ret = new Padding(borderWidth + y, borderWidth + y, borderWidth + y + _spacingTabSlantPadding - 1, 0);
                            else
                                ret = new Padding(borderWidth + y + _spacingTabSlantPadding - 1, borderWidth + y, borderWidth + y, 0);
                            break;
                    }
                    break;
                case TabBorderStyle.SlantEqualBoth:
                case TabBorderStyle.SlantOutsizeBoth:
                    // Calculte the extra needed for the outsize variant
                    int z = (tabBorderStyle == TabBorderStyle.SlantOutsizeBoth ? _spacingTabOutsizePadding : 0);

                    ret = new Padding(borderWidth + z + _spacingTabSlantPadding - 1, borderWidth + z,
                                      borderWidth + z + _spacingTabSlantPadding - 1, 0);
                    break;
                case TabBorderStyle.OneNote:
                    // Is the current tab selected?
                    bool selected = (state == PaletteState.CheckedNormal) ||
                                    (state == PaletteState.CheckedPressed) ||
                                    (state == PaletteState.CheckedTracking);

                    // Find the correct edge padding values to use
                    int lp = (selected ? _spacingTabOneNoteLPS : _spacingTabOneNoteLPI);
                    int tp = (selected ? _spacingTabOneNoteTPS : _spacingTabOneNoteTPI);
                    int bp = (selected ? _spacingTabOneNoteBPS : _spacingTabOneNoteBPI);
                    int rp = (selected ? _spacingTabOneNoteRPS : _spacingTabOneNoteRPI);

                    switch (orientation)
                    {
                        case VisualOrientation.Top:
                            if (rtl)
                                ret = new Padding(borderWidth + rp, borderWidth + tp, borderWidth + lp, bp);
                            else
                                ret = new Padding(borderWidth + lp, borderWidth + tp, borderWidth + rp, bp);
                            break;
                        case VisualOrientation.Left:
                            ret = new Padding(borderWidth + rp, borderWidth + tp, borderWidth + lp, bp);
                            break;
                        case VisualOrientation.Right:
                            ret = new Padding(borderWidth + lp, borderWidth + tp, borderWidth + rp, bp);
                            break;
                        case VisualOrientation.Bottom:
                            if (rtl)
                                ret = new Padding(borderWidth + lp, borderWidth + tp, borderWidth + rp, bp);
                            else
                                ret = new Padding(borderWidth + rp, borderWidth + tp, borderWidth + lp, bp);
                            break;
                    }
                    break;
                case TabBorderStyle.SmoothEqual:
                    ret = new Padding(borderWidth + _spacingTabSmoothLRE, borderWidth + _spacingTabSmoothTE, borderWidth + _spacingTabSmoothLRE, 0);
                    break;
                case TabBorderStyle.SmoothOutsize:
                    ret = new Padding(borderWidth + _spacingTabSmoothLRO, borderWidth + _spacingTabSmoothTO, borderWidth + _spacingTabSmoothLRO, 0);
                    break;
                default:
                    // Should never happen!
                    Debug.Assert(false);
                    break;
            }

            return ret;
        }
コード例 #23
0
ファイル: RenderStandard.cs プロジェクト: Cocotteseb/Krypton
        /// <summary>
        /// Draw border on the inside edge of the specified rectangle.
        /// </summary>
        /// <param name="context">Rendering context.</param>
        /// <param name="rect">Target rectangle.</param>
        /// <param name="palette">Palette used for drawing.</param>
        /// <param name="orientation">Visual orientation of the border.</param>
        /// <param name="state">State associated with rendering.</param>
        public override void DrawBorder(RenderContext context,
									    Rectangle rect,
									    IPaletteBorder palette,
										VisualOrientation orientation,
										PaletteState state)
        {
            Debug.Assert(context != null);
            Debug.Assert(palette != null);

            // Validate parameter references
            if (context == null) throw new ArgumentNullException("context");
            if (palette == null) throw new ArgumentNullException("palette");

            Debug.Assert(context.Control != null);
            Debug.Assert(!context.Control.IsDisposed);

            PaletteDrawBorders borders = palette.GetBorderDrawBorders(state);

            // Is there anything to actually draw?
            if ((rect.Width > 0) && (rect.Height > 0) && CommonHelper.HasABorder(borders))
            {
                // Only use anti aliasing if the border is rounded
                SmoothingMode smoothMode = (palette.GetBorderRounding(state) > 0 ? SmoothingMode.AntiAlias : SmoothingMode.Default);

                // We want to draw using anti aliasing for a nice smooth effect
                using (GraphicsHint hint = new GraphicsHint(context.Graphics, palette.GetBorderGraphicsHint(state)))
                {
                    // Cache commonly used values
                    int borderWidth = palette.GetBorderWidth(state);

                    // Get the orientation correct borders value
                    borders = CommonHelper.OrientateDrawBorders(borders, orientation);

                    // Is there any border to actually draw?
                    if (borderWidth > 0)
                    {
                        using (Clipping clip = new Clipping(context.Graphics, rect))
                        {
                            // We always create the first border path variant
                            GraphicsPath borderPath0 = CreateBorderBackPath(true, true, rect, borders, borderWidth,
                                                                            palette.GetBorderRounding(state),
                                                                            (smoothMode == SmoothingMode.AntiAlias), 0);

                            GraphicsPath borderPath1 = null;

                            // We only need the second border path if the two borders used are opposite each other
                            if ((borders == PaletteDrawBorders.TopBottom) ||
                                (borders == PaletteDrawBorders.LeftRight))
                            {
                                borderPath1 = CreateBorderBackPath(true, true, rect, borders, borderWidth,
                                                                   palette.GetBorderRounding(state),
                                                                   (smoothMode == SmoothingMode.AntiAlias), 1);
                            }

                            // Get the rectangle to use when dealing with gradients
                            Rectangle gradientRect = context.GetAlignedRectangle(palette.GetBorderColorAlign(state), rect);

                            // Use standard helper routine to create appropriate color brush
                            PaletteColorStyle colorStyle = palette.GetBorderColorStyle(state);
                            using (Pen borderPen = new Pen(CreateColorBrush(gradientRect,
                                                                            palette.GetBorderColor1(state),
                                                                            palette.GetBorderColor2(state),
                                                                            colorStyle,
                                                                            palette.GetBorderColorAngle(state),
                                                                            orientation), borderWidth))
                            {
                                if (colorStyle == PaletteColorStyle.Dashed)
                                    borderPen.DashPattern = new float[] { 2, 2 };

                                context.Graphics.DrawPath(borderPen, borderPath0);

                                // Optionally also draw the second path
                                if (borderPath1 != null)
                                    context.Graphics.DrawPath(borderPen, borderPath1);
                            }

                            Image borderImage = palette.GetBorderImage(state);
                            PaletteImageStyle borderImageStyle = palette.GetBorderImageStyle(state);

                            // Do we need to draw the image?
                            if (ShouldDrawImage(borderImage))
                            {
                                // Get the rectangle to use when dealing with gradients
                                Rectangle imageRect = context.GetAlignedRectangle(palette.GetBorderImageAlign(state), rect);

                                // Use standard helper routine to create appropriate image brush
                                using (Pen borderPen = new Pen(CreateImageBrush(imageRect, borderImage, borderImageStyle), borderWidth))
                                {
                                    context.Graphics.DrawPath(borderPen, borderPath0);

                                    // Optionally also draw the second path
                                    if (borderPath1 != null)
                                        context.Graphics.DrawPath(borderPen, borderPath1);
                                }
                            }

                            // Remember to dispose of resources
                            borderPath0.Dispose();

                            if (borderPath1 != null)
                                borderPath1.Dispose();
                        }
                    }
                }
            }
        }
コード例 #24
0
        /// <summary>
        /// Gets a value indicating which borders to draw.
        /// </summary>
        /// <param name="style">Border style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>PaletteDrawBorders value.</returns>
        public override PaletteDrawBorders GetBorderDrawBorders(PaletteBorderStyle style, PaletteState state)
        {
            IPaletteBorder inherit = GetInherit(state);

            return(inherit?.GetBorderDrawBorders(state) ?? Target.GetBorderDrawBorders(style, state));
        }
コード例 #25
0
 /// <summary>
 /// Set the redirection states.
 /// </summary>
 /// <param name="disabled">Redirection for disabled state requests.</param>
 /// <param name="normal">Redirection for normal state requests.</param>
 public virtual void SetRedirectStates(IPaletteBorder disabled,
                                       IPaletteBorder normal)
 {
     _disabled = disabled;
     _normal   = normal;
 }
 /// <summary>
 /// Initialize a new instance of the PaletteTabBorder class.
 /// </summary>
 /// <param name="inherit">Source for inheriting defaulted values.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public PaletteTabBorder(IPaletteBorder inherit,
                         NeedPaintHandler needPaint)
     : base(inherit, needPaint)
 {
 }
コード例 #27
0
        private void RenderCollapsedPressedBefore(RenderContext context)
        {
            switch (_lastRibbonShape)
            {
            default:
            case PaletteRibbonShape.Office2007:
            {
                IPaletteBack   paletteBack   = _ribbon.StateCommon.RibbonGroupCollapsedButton.PaletteBack;
                IPaletteBorder paletteBorder = _ribbon.StateCommon.RibbonGroupCollapsedButton.PaletteBorder;

                // Do we need to draw the background?
                if (paletteBack.GetBackDraw(PaletteState.Pressed) == InheritBool.True)
                {
                    // Get the border path which the background is clipped to drawing within
                    using (GraphicsPath borderPath = context.Renderer.RenderStandardBorder.GetBackPath(context, ClientRectangle, paletteBorder, VisualOrientation.Top, PaletteState.Pressed))
                    {
                        Padding borderPadding = context.Renderer.RenderStandardBorder.GetBorderRawPadding(paletteBorder, PaletteState.Pressed, VisualOrientation.Top);

                        // Apply the padding depending on the orientation
                        Rectangle enclosingRect = CommonHelper.ApplyPadding(VisualOrientation.Top, ClientRectangle, borderPadding);

                        // Render the background inside the border path
                        _mementoStandardBack = context.Renderer.RenderStandardBack.DrawBack(context, enclosingRect, borderPath,
                                                                                            paletteBack, VisualOrientation.Top,
                                                                                            PaletteState.Pressed, _mementoStandardBack);
                    }
                }

                // Do we need to draw the border?
                if (paletteBorder.GetBorderDraw(PaletteState.Pressed) == InheritBool.True)
                {
                    context.Renderer.RenderStandardBorder.DrawBorder(context, ClientRectangle, paletteBorder,
                                                                     VisualOrientation.Top, PaletteState.Pressed);
                }
            }
            break;

            case PaletteRibbonShape.Office2010:
            {
                Rectangle drawRect = ClientRectangle;

                IPaletteRibbonBack paletteBack   = _ribbon.StatePressed.RibbonGroupCollapsedBack;
                IPaletteRibbonBack paletteBorder = _ribbon.StatePressed.RibbonGroupCollapsedBorder;

                PaletteState state = PaletteState.Pressed;

                // Are we a group inside a context tab?
                if ((_ribbon.SelectedTab != null) && !string.IsNullOrEmpty(_ribbon.SelectedTab.ContextName))
                {
                    state = PaletteState.ContextPressed;
                }

                // Draw the group border
                _paletteContextBack.SetInherit(paletteBorder);
                _mementoRibbonBack1 = context.Renderer.RenderRibbon.DrawRibbonBack(_ribbon.RibbonShape, context, drawRect, state, _paletteContextBack, VisualOrientation.Top, false, _mementoRibbonBack1);

                Rectangle backRect = drawRect;
                backRect.Inflate(-2, -2);

                // Draw the inside background
                _mementoRibbonBack2 = context.Renderer.RenderRibbon.DrawRibbonBack(_ribbon.RibbonShape, context, backRect, state, paletteBack, VisualOrientation.Top, false, _mementoRibbonBack2);
            }
            break;
            }
        }
コード例 #28
0
 /// <summary>
 /// Gets and sets the palette to inherit from.
 /// </summary>
 public void SetInherit(IPaletteBorder paletteBorder)
 {
     Debug.Assert(paletteBorder != null);
     _inherit = paletteBorder;
 }
コード例 #29
0
ファイル: RenderStandard.cs プロジェクト: Cocotteseb/Krypton
        /// <summary>
        /// Generate a graphics path that encloses the border itself.
        /// </summary>
        /// <param name="context">Rendering context.</param>
        /// <param name="rect">Target rectangle.</param>
        /// <param name="palette">Palette used for drawing.</param>
        /// <param name="orientation">Visual orientation of the border.</param>
        /// <param name="state">State associated with rendering.</param>
        /// <param name="tabBorderStyle">Style of tab border.</param>
        /// <returns>GraphicsPath instance.</returns>
        public override GraphicsPath GetTabBorderPath(RenderContext context,
                                                      Rectangle rect,
                                                      IPaletteBorder palette,
                                                      VisualOrientation orientation,
                                                      PaletteState state,
                                                      TabBorderStyle tabBorderStyle)
        {
            Debug.Assert(context != null);
            Debug.Assert(palette != null);

            // Validate parameter references
            if (context == null) throw new ArgumentNullException("context");
            if (palette == null) throw new ArgumentNullException("palette");

            Debug.Assert(context.Control != null);
            Debug.Assert(!context.Control.IsDisposed);

            // Use helper to create a border path in middle of the pen
            return CreateTabBorderBackPath(context.Control.RightToLeft, state, false, rect,
                                           palette.GetBorderWidth(state), tabBorderStyle, orientation,
                                           (palette.GetBorderGraphicsHint(state) == PaletteGraphicsHint.AntiAlias));
        }
コード例 #30
0
        /// <summary>
        /// Gets the color border drawing style.
        /// </summary>
        /// <param name="style">Border style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Color drawing style.</returns>
        public override PaletteColorStyle GetBorderColorStyle(PaletteBorderStyle style, PaletteState state)
        {
            IPaletteBorder inherit = GetInherit(state);

            return(inherit?.GetBorderColorStyle(state) ?? Target.GetBorderColorStyle(style, state));
        }
コード例 #31
0
 /// <summary>
 /// Update the source palettes for drawing.
 /// </summary>
 /// <param name="paletteBack">Palette source for the background.</param>		
 /// <param name="paletteBorder">Palette source for the border.</param>
 public virtual void SetPalettes(IPaletteBack paletteBack,
                                 IPaletteBorder paletteBorder)
 {
     SetPalettes(paletteBack, paletteBorder, _paletteMetric);
 }
コード例 #32
0
        /// <summary>
        /// Gets the border corner rounding.
        /// </summary>
        /// <param name="style">Border style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Integer rounding.</returns>
        public override int GetBorderRounding(PaletteBorderStyle style, PaletteState state)
        {
            IPaletteBorder inherit = GetInherit(state);

            return(inherit?.GetBorderRounding(state) ?? Target.GetBorderRounding(style, state));
        }
コード例 #33
0
 private void DrawBorder(RenderContext context, 
                         Rectangle rect, 
                         IPaletteBorder paletteBorder, 
                         PaletteState state)
 {
     // Render the border over the background and children
     if (DrawTabBorder)
         context.Renderer.RenderTabBorder.DrawTabBorder(context, rect, _paletteBorder, _orientation, state, TabBorderStyle);
     else
         context.Renderer.RenderStandardBorder.DrawBorder(context, rect, _paletteBorder, _orientation, state);
 }
コード例 #34
0
 /// <summary>
 /// Initialize a new instance of the ViewDrawDocker class.
 /// </summary>
 /// <param name="paletteBack">Palette source for the background.</param>
 /// <param name="paletteBorder">Palette source for the border.</param>
 /// <param name="paletteMetric">Palette source for metrics.</param>
 public ViewDrawDocker(IPaletteBack paletteBack,
                       IPaletteBorder paletteBorder,
                       IPaletteMetric paletteMetric)
     : this(paletteBack, paletteBorder, paletteMetric, PaletteMetricBool.None)
 {
 }
コード例 #35
0
ファイル: ViewDrawCanvas.cs プロジェクト: Cocotteseb/Krypton
 /// <summary>
 /// Update the source palettes for drawing.
 /// </summary>
 /// <param name="paletteBack">Palette source for the background.</param>		
 /// <param name="paletteBorder">Palette source for the border.</param>
 public virtual void SetPalettes(IPaletteBack paletteBack,
                                 IPaletteBorder paletteBorder)
 {
     SetPalettes(paletteBack, paletteBorder, null);
 }
コード例 #36
0
ファイル: RenderBase.cs プロジェクト: Cocotteseb/Krypton
 /// <summary>
 /// Perform drawing of a separator glyph.
 /// </summary>
 /// <param name="context">Render context.</param>
 /// <param name="displayRect">Display area available for drawing.</param>
 /// <param name="paletteBack">Background palette details.</param>
 /// <param name="paletteBorder">Border palette details.</param>
 /// <param name="orientation">Visual orientation of the content.</param>
 /// <param name="state">State associated with rendering.</param>
 /// <param name="canMove">Can the separator be moved.</param>
 public abstract void DrawSeparator(RenderContext context,
                                    Rectangle displayRect,
                                    IPaletteBack paletteBack,
                                    IPaletteBorder paletteBorder,
                                    Orientation orientation,
                                    PaletteState state,
                                    bool canMove);
コード例 #37
0
ファイル: ViewDrawSplitCanvas.cs プロジェクト: yp25/Krypton
 /// <summary>
 /// Update the source palettes for drawing.
 /// </summary>
 /// <param name="paletteBack">Palette source for the background.</param>
 /// <param name="paletteBorder">Palette source for the border.</param>
 public virtual void SetPalettes(IPaletteBack paletteBack,
                                 IPaletteBorder paletteBorder)
 {
     SetPalettes(paletteBack, paletteBorder, _paletteMetric);
 }
コード例 #38
0
ファイル: RenderBase.cs プロジェクト: Cocotteseb/Krypton
 /// <summary>
 /// Evaluate if transparent painting is needed for background or border palettes.
 /// </summary>
 /// <param name="paletteBack">Background palette to test.</param>
 /// <param name="paletteBorder">Background palette to test.</param>
 /// <param name="state">Element state associated with palette.</param>
 /// <returns>True if transparent painting required.</returns>
 public abstract bool EvalTransparentPaint(IPaletteBack paletteBack,
                                           IPaletteBorder paletteBorder,
                                           PaletteState state);
コード例 #39
0
        /// <summary>
        /// the main difference with a Group row and a regular row is the way it is painted on the control.
        /// the Paint method is therefore overridden and specifies how the Group row is painted.
        /// Note: this method is not implemented optimally. It is merely used for demonstration purposes
        /// </summary>
        /// <param name="graphics"></param>
        /// <param name="clipBounds"></param>
        /// <param name="rowBounds"></param>
        /// <param name="rowIndex"></param>
        /// <param name="rowState"></param>
        /// <param name="isFirstDisplayedRow"></param>
        /// <param name="isLastVisibleRow"></param>
        protected override void Paint(System.Drawing.Graphics graphics, System.Drawing.Rectangle clipBounds, Rectangle rowBounds, int rowIndex, DataGridViewElementStates rowState, bool isFirstDisplayedRow, bool isLastVisibleRow)
        {
            if (this.isGroupRow)
            {
                KryptonOutlookGrid grid = (KryptonOutlookGrid)this.DataGridView;
                int rowHeadersWidth     = grid.RowHeadersVisible ? grid.RowHeadersWidth : 0;

                int       gridwidth   = grid.Columns.GetColumnsWidth(DataGridViewElementStates.Visible);
                Rectangle myRowBounds = rowBounds;
                myRowBounds.Width = gridwidth;

                IPaletteBack   paletteBack   = grid.StateNormal.DataCell.Back;
                IPaletteBorder paletteBorder = grid.StateNormal.DataCell.Border;

                PaletteState state = PaletteState.Normal;
                if (grid.PreviousSelectedGroupRow == rowIndex)
                {
                    state = PaletteState.CheckedNormal;
                }

                using (RenderContext renderContext = new RenderContext(grid, graphics, myRowBounds, grid.Renderer))
                {
                    using (GraphicsPath path = grid.Renderer.RenderStandardBorder.GetBackPath(renderContext, myRowBounds, paletteBorder, VisualOrientation.Top, PaletteState.Normal))
                    {
                        //Back
                        IDisposable unused = grid.Renderer.RenderStandardBack.DrawBack(renderContext,
                                                                                       myRowBounds,
                                                                                       path,
                                                                                       paletteBack,
                                                                                       VisualOrientation.Top,
                                                                                       state,
                                                                                       null);

                        // We never save the memento for reuse later
                        if (unused != null)
                        {
                            unused.Dispose();
                            unused = null;
                        }
                    }
                }

                //Set the icon and lines according to the renderer
                if (group.Collapsed)
                {
                    if (KryptonManager.CurrentGlobalPalette.GetRenderer() == KryptonManager.RenderOffice2010)
                    {
                        graphics.DrawImage(Properties.Resources.CollapseIcon2010, rowBounds.Left + rowHeadersWidth - grid.HorizontalScrollingOffset + 4 + group.Level * 15, rowBounds.Bottom - 18, 11, 11);
                    }
                    else
                    {
                        graphics.DrawImage(Properties.Resources.ExpandIcon, rowBounds.Left + rowHeadersWidth - grid.HorizontalScrollingOffset + 4 + group.Level * 15, rowBounds.Bottom - 18, 11, 11);
                    }
                }
                else
                {
                    if (KryptonManager.CurrentGlobalPalette.GetRenderer() == KryptonManager.RenderOffice2010)
                    {
                        graphics.DrawImage(Properties.Resources.ExpandIcon2010, rowBounds.Left + rowHeadersWidth - grid.HorizontalScrollingOffset + 4 + group.Level * 15, rowBounds.Bottom - 18, 11, 11);
                    }
                    else
                    {
                        graphics.DrawImage(Properties.Resources.CollapseIcon, rowBounds.Left + rowHeadersWidth - grid.HorizontalScrollingOffset + 4 + group.Level * 15, rowBounds.Bottom - 18, 11, 11);
                    }
                }

                // Draw the botton : solid line for 2007 palettes or dot line for 2010 palettes
                if (KryptonManager.CurrentGlobalPalette.GetRenderer() == KryptonManager.RenderOffice2010)
                {
                    using (Pen focusPen = new Pen(Color.Gray))
                    {
                        focusPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
                        graphics.DrawLine(focusPen, rowBounds.Left + rowHeadersWidth - grid.HorizontalScrollingOffset, rowBounds.Bottom - 1, gridwidth + 1, rowBounds.Bottom - 1);
                    }
                }
                else
                {
                    using (SolidBrush br = new SolidBrush(paletteBorder.GetBorderColor1(state)))
                    {
                        graphics.FillRectangle(br, rowBounds.Left + rowHeadersWidth - grid.HorizontalScrollingOffset, rowBounds.Bottom - 2, gridwidth + 1, 2);
                    }
                }

                //Draw right vertical bar
                if (grid.CellBorderStyle == DataGridViewCellBorderStyle.SingleVertical || grid.CellBorderStyle == DataGridViewCellBorderStyle.Single)
                {
                    using (SolidBrush br = new SolidBrush(paletteBorder.GetBorderColor1(state)))
                    {
                        graphics.FillRectangle(br, rowBounds.Left + rowHeadersWidth - grid.HorizontalScrollingOffset + gridwidth, rowBounds.Top, 1, rowBounds.Height);
                    }
                }

                //Draw image group
                int imageoffset = 0;
                if (this.group.GroupImage != null)
                {
                    graphics.DrawImage(this.group.GroupImage, rowHeadersWidth - grid.HorizontalScrollingOffset + 18 + group.Level * 15, rowBounds.Bottom - 22, 16, 16);
                    imageoffset = 18;
                }

                //Draw text, using the current grid font
                int offsetText = rowHeadersWidth - grid.HorizontalScrollingOffset + 18 + imageoffset + group.Level * 15;
                //grid.GridPalette.GetContentShortTextFont(PaletteContentStyle.GridHeaderColumnList, state)
                TextRenderer.DrawText(graphics, group.Text, grid.GridPalette.GetContentShortTextFont(PaletteContentStyle.LabelBoldControl, state), new Rectangle(offsetText, rowBounds.Bottom - 20, rowBounds.Width - offsetText, rowBounds.Height), grid.GridPalette.GetContentShortTextColor1(PaletteContentStyle.LabelNormalControl, state),
                                      TextFormatFlags.EndEllipsis | TextFormatFlags.SingleLine | TextFormatFlags.PreserveGraphicsClipping);
            }
            else
            {
                base.Paint(graphics, clipBounds, rowBounds, rowIndex, rowState, isFirstDisplayedRow, isLastVisibleRow);
            }
        }
コード例 #40
0
 /// <summary>
 /// Gets and sets the palette to inherit from.
 /// </summary>
 public void SetInherit(IPaletteBorder paletteBorder)
 {
     Debug.Assert(paletteBorder != null);
     _inherit = paletteBorder;
 }
コード例 #41
0
 /// <summary>
 /// Initialize a new instance of the BackToBorder class.
 /// </summary>
 /// <param name="parent">Parent to get border values from.</param>
 public BackToBorder(IPaletteBorder parent)
 {
     Debug.Assert(parent != null);
     _parent = parent;
 }
コード例 #42
0
 /// <summary>
 /// Initialize a new instance of the ViewDrawGroupBoxDocker class.
 /// </summary>
 /// <param name="paletteBack">Palette source for the background.</param>
 /// <param name="paletteBorder">Palette source for the border.</param>
 public ViewDrawGroupBoxDocker(IPaletteBack paletteBack,
                               IPaletteBorder paletteBorder)
     : base(paletteBack, paletteBorder)
 {
     CaptionOverlap = 0.5;
 }
コード例 #43
0
ファイル: RenderBase.cs プロジェクト: Cocotteseb/Krypton
 /// <summary>
 /// Gets the padding used to position display elements completely inside border drawing.
 /// </summary>
 /// <param name="context">Layout context.</param>
 /// <param name="palette">Palette used for drawing.</param>
 /// <param name="state">State associated with rendering.</param>
 /// <param name="orientation">Visual orientation of the border.</param>
 /// <param name="tabBorderStyle">Style of tab border.</param>
 /// <returns>Padding structure detailing all four edges.</returns>
 public abstract Padding GetTabBorderDisplayPadding(ViewLayoutContext context,
                                                    IPaletteBorder palette,
                                                    PaletteState state,
                                                    VisualOrientation orientation,
                                                    TabBorderStyle tabBorderStyle);
コード例 #44
0
        /// <summary>
        /// Gets the image border alignment.
        /// </summary>
        /// <param name="style">Border style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Image alignment style.</returns>
        public override PaletteRectangleAlign GetBorderImageAlign(PaletteBorderStyle style, PaletteState state)
        {
            IPaletteBorder inherit = GetInherit(state);

            return(inherit?.GetBorderImageAlign(state) ?? Target.GetBorderImageAlign(style, state));
        }
コード例 #45
0
ファイル: RenderBase.cs プロジェクト: Cocotteseb/Krypton
 /// <summary>
 /// Draw border on the inside edge of the specified rectangle.
 /// </summary>
 /// <param name="context">Rendering context.</param>
 /// <param name="rect">Target rectangle.</param>
 /// <param name="palette">Palette used for drawing.</param>
 /// <param name="orientation">Visual orientation of the border.</param>
 /// <param name="state">State associated with rendering.</param>
 /// <param name="tabBorderStyle">Style of tab border.</param>
 public abstract void DrawTabBorder(RenderContext context,
                                    Rectangle rect,
                                    IPaletteBorder palette,
                                    VisualOrientation orientation,
                                    PaletteState state,
                                    TabBorderStyle tabBorderStyle);
コード例 #46
0
 /// <summary>
 /// Update the source palettes for drawing.
 /// </summary>
 /// <param name="paletteBorder">Palette source for the border.</param>
 public virtual void SetPalette(IPaletteBorder paletteBorder)
 {
     _inherit = paletteBorder;
 }
コード例 #47
0
ファイル: RenderBase.cs プロジェクト: Cocotteseb/Krypton
 /// <summary>
 /// Gets the raw padding used per edge of the border.
 /// </summary>
 /// <param name="palette">Palette used for drawing.</param>
 /// <param name="state">State associated with rendering.</param>
 /// <param name="orientation">Visual orientation of the border.</param>
 /// <returns>Padding structure detailing all four edges.</returns>
 public abstract Padding GetBorderRawPadding(IPaletteBorder palette,
                                             PaletteState state,
                                             VisualOrientation orientation);
コード例 #48
0
 /// <summary>
 /// Initialize a new instance of the ViewDrawGroupBoxDocker class.
 /// </summary>
 /// <param name="paletteBack">Palette source for the background.</param>
 /// <param name="paletteBorder">Palette source for the border.</param>
 public ViewDrawGroupBoxDocker(IPaletteBack paletteBack,
                               IPaletteBorder paletteBorder)
     : base(paletteBack, paletteBorder) =>
コード例 #49
0
ファイル: RenderBase.cs プロジェクト: Cocotteseb/Krypton
 /// <summary>
 /// Generate a graphics path that encloses the border itself.
 /// </summary>
 /// <param name="context">Rendering context.</param>
 /// <param name="rect">Target rectangle.</param>
 /// <param name="palette">Palette used for drawing.</param>
 /// <param name="orientation">Visual orientation of the border.</param>
 /// <param name="state">State associated with rendering.</param>
 /// <param name="tabBorderStyle">Style of tab border.</param>
 /// <returns>GraphicsPath instance.</returns>
 public abstract GraphicsPath GetTabBorderPath(RenderContext context,
                                               Rectangle rect,
                                               IPaletteBorder palette,
                                               VisualOrientation orientation,
                                               PaletteState state,
                                               TabBorderStyle tabBorderStyle);
コード例 #50
0
        /// <summary>
        /// Perform rendering before child elements are rendered.
        /// </summary>
        /// <param name="context">Rendering context.</param>
        public override void RenderBefore(RenderContext context)
        {
            // Update the enabled state of the button
            Enabled = _ribbon.Enabled;


            IPaletteBack          paletteBack    = _ribbon.StateCommon.RibbonGroupDialogButton.PaletteBack;
            IPaletteBorder        paletteBorder  = _ribbon.StateCommon.RibbonGroupDialogButton.PaletteBorder;
            IPaletteRibbonGeneral paletteGeneral = _ribbon.StateCommon.RibbonGeneral;

            if (_ribbon.RibbonShape == PaletteRibbonShape.NeoAxis)
            {
                paletteBack    = _ribbon.StateCommon.RibbonQATButton.PaletteBack;
                paletteBorder  = _ribbon.StateCommon.RibbonQATButton.PaletteBorder;
                paletteGeneral = _ribbon.StateCommon.RibbonGeneral;
            }

            // Do we need to draw the background?
            if (paletteBack.GetBackDraw(State) == InheritBool.True)
            {
                // Get the border path which the background is clipped to drawing within
                using (GraphicsPath borderPath = context.Renderer.RenderStandardBorder.GetBackPath(context, ClientRectangle, paletteBorder, VisualOrientation.Top, State))
                {
                    Padding borderPadding = context.Renderer.RenderStandardBorder.GetBorderRawPadding(paletteBorder, State, VisualOrientation.Top);

                    // Apply the padding depending on the orientation
                    Rectangle enclosingRect = CommonHelper.ApplyPadding(VisualOrientation.Top, ClientRectangle, borderPadding);

                    // Render the background inside the border path
                    _mementoBack = context.Renderer.RenderStandardBack.DrawBack(context, enclosingRect, borderPath,
                                                                                paletteBack, VisualOrientation.Top,
                                                                                State, _mementoBack);
                }
            }

            // Do we need to draw the border?
            if (paletteBorder.GetBorderDraw(State) == InheritBool.True)
            {
                context.Renderer.RenderStandardBorder.DrawBorder(context, ClientRectangle, paletteBorder,
                                                                 VisualOrientation.Top, State);
            }

            // Find the content area inside the button rectangle
            Rectangle contentRect = ClientRectangle;
            var       contentSize = new Size(-(ClientRectangle.Width - _imageSize.Width) / 2,
                                             -(ClientRectangle.Height - _imageSize.Height) / 2);

            contentRect.Inflate(contentSize);

            bool isMinibar = _ribbon.QATLocation == QATLocation.Above;

            // Decide if we are drawing an overflow or context arrow image
            if (Overflow)
            {
                context.Renderer.RenderGlyph.DrawRibbonOverflow(_ribbon.RibbonShape, context, contentRect, paletteGeneral, State);
            }
            else
            {
                context.Renderer.RenderGlyph.DrawRibbonContextArrow(_ribbon.RibbonShape, context, contentRect, paletteGeneral, State, isMinibar);
            }
        }