/// <summary> /// Gets the second back color for the long text. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Color value.</returns> public override Color GetContentLongTextColor2(PaletteState state) { if (state == PaletteState.Normal) return _ribbon.StateCommon.RibbonGeneral.GetRibbonGroupSeparatorLight(state); else return _ribbon.StateCommon.RibbonGroupButton.Content.GetContentShortTextColor1(state); }
/// <summary> /// Gets the first background color. /// </summary> /// <param name="style">Background style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Color value.</returns> public override Color GetBackColor1(PaletteBackStyle style, PaletteState state) { // Only override system palette if a recognized office 2003 color scheme is used if (_usingOffice2003) { switch (style) { case PaletteBackStyle.ContextMenuItemHighlight: switch (state) { case PaletteState.Disabled: return SystemColors.Control; case PaletteState.Normal: return Color.Empty; case PaletteState.Tracking: return ColorTable.MenuItemSelectedGradientBegin; } break; case PaletteBackStyle.HeaderDockInactive: if (state == PaletteState.Disabled) return SystemColors.Control; else return ColorTable.ButtonCheckedHighlight; case PaletteBackStyle.HeaderDockActive: if (state == PaletteState.Disabled) return SystemColors.Control; else return SystemColors.Highlight; } } return base.GetBackColor1(style, state); }
/// <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); } }
/// <summary> /// Gets the second back color for the long text. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Color value.</returns> public override Color GetContentLongTextColor2(PaletteState state) { if (state == PaletteState.Disabled) return _ribbonGroupTextDisabled.GetRibbonTextColor(state); else return _ribbonGroupTextNormal.GetRibbonTextColor(state); }
/// <summary> /// Initialize a new instance of the KryptonBorderEdge class. /// </summary> public KryptonBorderEdge() { // The label cannot take the focus SetStyle(ControlStyles.Selectable, false); // Set default label style _orientation = Orientation.Horizontal; // Create the palette storage _borderRedirect = new PaletteBorderInheritRedirect(Redirector, PaletteBorderStyle.ControlClient); _stateCommon = new PaletteBorderEdgeRedirect(_borderRedirect, NeedPaintDelegate); _stateDisabled = new PaletteBorderEdge(_stateCommon, NeedPaintDelegate); _stateNormal = new PaletteBorderEdge(_stateCommon, NeedPaintDelegate); _stateCurrent = _stateNormal; _state = PaletteState.Normal; // Our view contains just a simple canvas that covers entire client area _drawPanel = new ViewDrawPanel(_stateNormal); // Create the view manager instance ViewManager = new ViewManager(this, _drawPanel); // We want to be auto sized by default, but not the property default! AutoSize = true; AutoSizeMode = AutoSizeMode.GrowAndShrink; }
/// <summary> /// Gets a drop down button image appropriate for the provided state. /// </summary> /// <param name="state">PaletteState for which image is required.</param> public override Image GetDropDownButtonImage(PaletteState state) { // Grab state specific image Image retImage = null; switch(state) { case PaletteState.Disabled: retImage = _images.Disabled; break; case PaletteState.Normal: retImage = _images.Normal; break; case PaletteState.Tracking: retImage = _images.Tracking; break; case PaletteState.Pressed: retImage = _images.Pressed; break; } // Not found, then get the common image if (retImage == null) retImage = _images.Common; // Not found, then inherit from target if (retImage == null) retImage = Target.GetDropDownButtonImage(state); return retImage; }
/// <summary> /// Gets the second back color. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Color value.</returns> public override Color GetBackColor2(PaletteState state) { if ((TreeNode != null) && (TreeNode.BackColor != Color.Empty)) return TreeNode.BackColor; else return _inherit.GetBackColor2(state); }
/// <summary> /// Draw a drop down grid appropriate for a input control. /// </summary> /// <param name="context">Render context.</param> /// <param name="cellRect">Available drawing rectangle space.</param> /// <param name="paletteContent">Content palette for getting colors.</param> /// <param name="state">State associated with rendering.</param> public override void DrawInputControlDropDownGlyph(RenderContext context, Rectangle cellRect, IPaletteContent paletteContent, PaletteState state) { Debug.Assert(context != null); Debug.Assert(paletteContent != null); // Validate parameter references if (context == null) throw new ArgumentNullException("context"); if (paletteContent == null) throw new ArgumentNullException("paletteContent"); Color c1 = paletteContent.GetContentShortTextColor1(state); // Find the top left starting position for drawing lines int xStart = cellRect.Left + (cellRect.Right - cellRect.Left - 4) / 2; int yStart = cellRect.Top + (cellRect.Bottom - cellRect.Top - 3) / 2; using (Pen darkPen = new Pen(c1)) { context.Graphics.DrawLine(darkPen, xStart, yStart, xStart + 4, yStart); context.Graphics.DrawLine(darkPen, xStart + 1, yStart + 1, xStart + 3, yStart + 1); context.Graphics.DrawLine(darkPen, xStart + 2, yStart + 2, xStart + 2, yStart + 1); } }
/// <summary> /// Initialize a new instance of the PaletteRibbonTabContentInheritOverride class. /// </summary> /// <param name="primaryBack">First choice inheritence background.</param> /// <param name="primaryText">First choice inheritence text.</param> /// <param name="primaryContent">First choice inheritence content.</param> /// <param name="backupBack">Backup inheritence background.</param> /// <param name="backupText">Backup inheritence text.</param> /// <param name="backupContent">Backup inheritence content.</param> /// <param name="state">Palette state to override.</param> public PaletteRibbonTabContentInheritOverride(IPaletteRibbonBack primaryBack, IPaletteRibbonText primaryText, IPaletteContent primaryContent, IPaletteRibbonBack backupBack, IPaletteRibbonText backupText, IPaletteContent backupContent, PaletteState state) { Debug.Assert(primaryBack != null); Debug.Assert(primaryText != null); Debug.Assert(primaryContent != null); Debug.Assert(backupBack != null); Debug.Assert(backupText != null); Debug.Assert(backupContent != null); // Remember values _primaryBack = primaryBack; _primaryText = primaryText; _primaryContent = primaryContent; _backupBack = backupBack; _backupText = backupText; _backupContent = backupContent; // Default state _apply = false; _override = true; _state = state; }
/// <summary> /// Gets the first back color for the long text. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Color value.</returns> public override Color GetContentLongTextColor1(PaletteState state) { if (_overrideTextColor != Color.Empty) return _overrideTextColor; else return RibbonGeneral.GetRibbonContextTextColor(state); }
/// <summary> /// Gets the second back color. /// </summary> /// <param name="style">Background style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Color value.</returns> public override Color GetBackColor2(PaletteBackStyle style, PaletteState state) { IPaletteTriple inherit = GetInherit(state); if (inherit != null) return inherit.PaletteBack.GetBackColor2(state); else return base.GetBackColor2(style, state); }
/// <summary> /// Gets a boolean metric value. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <param name="metric">Requested metric.</param> /// <returns>InheritBool value.</returns> public override InheritBool GetMetricBool(PaletteState state, PaletteMetricBool metric) { IPaletteMetric inherit = GetInherit(state); if (inherit != null) return inherit.GetMetricBool(state, metric); else return Target.GetMetricBool(state, metric); }
/// <summary> /// Gets the second back color. /// </summary> /// <param name="style">Background style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Color value.</returns> public override Color GetBackColor2(PaletteBackStyle style, PaletteState state) { IPaletteBack inherit = GetInheritBack(style, state); if (inherit != null) return inherit.GetBackColor2(state); else return Target.GetBackColor2(style, state); }
/// <summary> /// Gets the first border color. /// </summary> /// <param name="style">Border style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Color value.</returns> public override Color GetBorderColor1(PaletteBorderStyle style, PaletteState state) { PaletteBorderEdge inherit = GetInherit(state); if (inherit != null) return inherit.GetBackColor1(state); else return Target.GetBorderColor1(style, state); }
/// <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) { PaletteDrawBorders paletteBorder = base.GetBorderDrawBorders(style, state); // The ribbon caption area should only ever draw a bottom border as the maximum if ((paletteBorder & PaletteDrawBorders.Bottom) == PaletteDrawBorders.Bottom) return PaletteDrawBorders.Bottom; else return PaletteDrawBorders.None; }
/// <summary> /// Gets the second background color for the ribbon item. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Color value.</returns> public Color GetRibbonBackColor2(PaletteState state) { Color retColor = _inherit.GetRibbonBackColor2(state); // If empty then try and recover the context specific color if (retColor == Color.Empty) retColor = CheckForContextColor(state); return retColor; }
/// <summary> /// Gets the second back color for the long text. /// </summary> /// <param name="style">Content style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Color value.</returns> public override Color GetContentLongTextColor2(PaletteContentStyle style, PaletteState state) { // We only want to override buttons specs that are drawing in normal mode if ((style == PaletteContentStyle.ButtonButtonSpec) && (state == PaletteState.Normal)) { // If the ribbon is showing in office 2010 style and using glass if (_ribbon.CaptionArea.DrawCaptionOnComposition && (_ribbon.RibbonShape == PaletteRibbonShape.Office2010)) return LightBackground(base.GetContentLongTextColor2(style, state)); } return base.GetContentLongTextColor2(style, state); }
/// <summary> /// Gets the first background color. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Color value.</returns> public override Color GetBackColor1(PaletteState state) { switch (state) { case PaletteState.Normal: return _cellStyle.BackColor; case PaletteState.CheckedNormal: return _cellStyle.SelectionBackColor; } return _inherit.GetBackColor1(state); }
/// <summary> /// Initialize a new instance of the PaletteElementColorInheritOverride class. /// </summary> /// <param name="primary">First choice inheritence.</param> /// <param name="backup">Backup inheritence.</param> public PaletteElementColorInheritOverride(IPaletteElementColor primary, IPaletteElementColor 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; }
/// <summary> /// Initialize a new instance of the PaletteNavigatorOverride class. /// </summary> /// <param name="checkButtonNormal">Normal palette to use.</param> /// <param name="checkButtonOther">Override palette to use.</param> /// <param name="overrideState">State used by the override.</param> public PaletteNavigatorOverride(IPaletteTriple checkButtonNormal, IPaletteTriple checkButtonOther, PaletteState overrideState) { Debug.Assert(checkButtonNormal != null); Debug.Assert(checkButtonOther != null); // Create the palette storage _overrideCheckButton = new PaletteTripleOverride(checkButtonNormal, checkButtonOther, overrideState); // Do not apply an override by default Apply = false; }
/// <summary> /// Draw a design area with a flap on the left hand edge. /// </summary> /// <param name="ribbon">Reference to owning ribbon control.</param> /// <param name="context">Rendering context.</param> /// <param name="clientRect">Client rectangle of the source view.</param> /// <param name="state">State of element.</param> public static void DrawArea(KryptonRibbon ribbon, RenderContext context, Rectangle clientRect, PaletteState state) { Color c; if (state == PaletteState.Normal) c = ribbon.StateCommon.RibbonGeneral.GetRibbonGroupSeparatorDark(PaletteState.Normal); else c = ribbon.StateCommon.RibbonGroupButton.Back.GetBackColor1(PaletteState.Tracking); // Draw entire area in color using (SolidBrush darkBrush = new SolidBrush(c)) context.Graphics.FillRectangle(darkBrush, clientRect); }
/// <summary> /// Initialize a new instance of the PaletteContentInheritOverride class. /// </summary> /// <param name="primary">First choice inheritence.</param> /// <param name="backup">Backup inheritence.</param> /// <param name="overrideState">State used by the override.</param> /// <param name="apply">Should the override we used.</param> public PaletteContentInheritOverride(IPaletteContent primary, IPaletteContent backup, PaletteState overrideState, bool apply) { Debug.Assert(primary != null); Debug.Assert(backup != null); // Store incoming values _primary = primary; _backup = backup; _apply = apply; _state = overrideState; // By default we do override the state _override = true; }
/// <summary> /// Perform drawing of a ribbon cluster edge. /// </summary> /// <param name="shape">Ribbon shape.</param> /// <param name="context">Render context.</param> /// <param name="displayRect">Display area available for drawing.</param> /// <param name="paletteBack">Palette used for recovering drawing details.</param> /// <param name="state">State associated with rendering.</param> public override void DrawRibbonClusterEdge(PaletteRibbonShape shape, RenderContext context, Rectangle displayRect, IPaletteBack paletteBack, PaletteState state) { Debug.Assert(context != null); Debug.Assert(paletteBack != null); // Get the first border color Color borderColor = paletteBack.GetBackColor1(state); // We want to lighten it by merging with white Color lightColor = CommonHelper.MergeColors(borderColor, BORDER_PERCENT, Color.White, WHITE_PERCENT); // Draw inside of the border edge in a lighter version of the border using (SolidBrush drawBrush = new SolidBrush(lightColor)) context.Graphics.FillRectangle(drawBrush, displayRect); }
/// <summary> /// Initialize a new instance of the PaletteDoubleOverride class. /// </summary> /// <param name="normalTriple">Normal palette to use.</param> /// <param name="overrideTriple">Override palette to use.</param> /// <param name="overrideState">State used by the override.</param> public PaletteDoubleOverride(IPaletteDouble normalTriple, IPaletteDouble overrideTriple, PaletteState overrideState) { Debug.Assert(normalTriple != null); Debug.Assert(overrideTriple != null); if (normalTriple == null) throw new ArgumentNullException("normalTriple"); if (overrideTriple == null) throw new ArgumentNullException("overrideTriple"); // Create the triple override instances _overrideBack = new PaletteBackInheritOverride(normalTriple.PaletteBack, overrideTriple.PaletteBack); _overrideBorder = new PaletteBorderInheritOverride(normalTriple.PaletteBorder, overrideTriple.PaletteBorder); // Do not apply an override by default Apply = false; // Always override the state Override = true; OverrideState = overrideState; }
/// <summary> /// Initialize a new instance of the PaletteTrackBarPositionStatesOverride class. /// </summary> /// <param name="normalStates">Normal state values.</param> /// <param name="overrideStates">Override state values.</param> /// <param name="overrideState">State to override.</param> public PaletteTrackBarPositionStatesOverride(PaletteTrackBarRedirect normalStates, PaletteTrackBarPositionStates overrideStates, PaletteState overrideState) { Debug.Assert(normalStates != null); Debug.Assert(overrideStates != null); // Validate incoming references if (normalStates == null) throw new ArgumentNullException("normalStates"); if (overrideStates == null) throw new ArgumentNullException("overrideStates"); // Create the override instance _overridePositionState = new PaletteElementColorInheritOverride(normalStates.Position, overrideStates.Position); // Do not apply an override by default Apply = false; // Always override the state Override = true; OverrideState = overrideState; }
/// <summary> /// Initialize a new instance of the ButtonSpecNavManagerLayoutHeaderBar class. /// </summary> /// <param name="control">Control that owns the button manager.</param> /// <param name="redirector">Palette redirector.</param> /// <param name="variableSpecs">Variable set of button specifications.</param> /// <param name="fixedSpecs">Fixed set of button specifications.</param> /// <param name="viewDockers">Array of target view dockers.</param> /// <param name="viewMetrics">Array of target metric providers.</param> /// <param name="viewMetricIntOutside">Array of target metrics for outside spacer size.</param> /// <param name="viewMetricIntInside">Array of target metrics for inside spacer size.</param> /// <param name="viewMetricPaddings">Array of target metrics for button padding.</param> /// <param name="getRenderer">Delegate for returning a tool strip renderer.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> /// <param name="paletteContent">Palette source for color remapping.</param> /// <param name="paletteState">Palette state for color remapping.</param> public ButtonSpecNavManagerLayoutHeaderBar(Control control, PaletteRedirect redirector, ButtonSpecCollectionBase variableSpecs, ButtonSpecCollectionBase fixedSpecs, ViewLayoutDocker[] viewDockers, IPaletteMetric[] viewMetrics, PaletteMetricInt[] viewMetricIntOutside, PaletteMetricInt[] viewMetricIntInside, PaletteMetricPadding[] viewMetricPaddings, GetToolStripRenderer getRenderer, NeedPaintHandler needPaint, IPaletteContent paletteContent, PaletteState paletteState) : base(control, redirector, variableSpecs, fixedSpecs, viewDockers, viewMetrics, viewMetricIntOutside, viewMetricIntInside, viewMetricPaddings, getRenderer, needPaint) { // Remember initial palette settings needed for color remapping _paletteContent = paletteContent; _paletteState = paletteState; }
/// <summary> /// Gets the content image. /// </summary> /// <param name="state">The state for which the image is needed.</param> /// <returns>Image value.</returns> public override Image GetImage(PaletteState state) { Image image = null; // Try and get a state specific image switch (state) { case PaletteState.CheckedNormal: image = _imageStates.ImageCheckedNormal; break; case PaletteState.CheckedPressed: image = _imageStates.ImageCheckedPressed; break; case PaletteState.CheckedTracking: image = _imageStates.ImageCheckedTracking; break; } if (image == null) image = base.GetImage(state); return image; }
/// <summary> /// Gets the horizontal relative alignment of multiline short text. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>RelativeAlignment value.</returns> public virtual PaletteRelativeAlign GetContentShortTextMultiLineH(PaletteState state) { return(PaletteRelativeAlign.Near); }
/// <summary> /// Gets the method used to draw the background of a ribbon item. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>PaletteRibbonBackStyle value.</returns> public abstract PaletteRibbonColorStyle GetRibbonBackColorStyle(PaletteState state);
/// <summary> /// Gets the second back color. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Color value.</returns> public Color GetBackColor2(PaletteState state) { return(_parent.GetBorderColor2(state)); }
/// <summary> /// Gets the actual background graphics hint value. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>PaletteGraphicsHint value.</returns> public PaletteGraphicsHint GetBackGraphicsHint(PaletteState state) { // We never want the border edge to use anti aliasing return(PaletteGraphicsHint.None); }
/// <summary> /// Fix the control to a particular palette state. /// </summary> /// <param name="state">Palette state to fix.</param> public virtual void SetFixedState(PaletteState state) { // Request fixed state from the view _drawContent.FixedState = state; }
/// <summary> /// Gets the text trimming to use for short text. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>PaletteTextTrim value.</returns> public virtual PaletteTextTrim GetContentShortTextTrim(PaletteState state) { return(PaletteTextTrim.EllipsisCharacter); }
/// <summary> /// Gets the second back color for the short text. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Color value.</returns> public virtual Color GetContentShortTextColor2(PaletteState state) { return(Color.Empty); }
/// <summary> /// Gets a drop down button image appropriate for the provided state. /// </summary> /// <param name="state">PaletteState for which image is required.</param> public override Image GetDropDownButtonImage(PaletteState state) { return(state != PaletteState.Disabled ? _silverDropDownButton : base.GetDropDownButtonImage(state)); }
/// <summary> /// Gets the prefix drawing setting for short text. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>PaletteTextPrefix value.</returns> public virtual PaletteTextHotkeyPrefix GetContentShortTextPrefix(PaletteState state) { return(PaletteTextHotkeyPrefix.None); }
/// <summary> /// Gets the rendering hint for the short text. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>PaletteTextHint value.</returns> public virtual PaletteTextHint GetContentShortTextHint(PaletteState state) { return(RibbonGeneral.GetRibbonTextHint(state)); }
/// <summary> /// Gets the flag indicating if multiline text is allowed for short text. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>InheritBool value.</returns> public virtual InheritBool GetContentShortTextMultiLine(PaletteState state) { return(InheritBool.False); }
/// <summary> /// Gets the actual background draw value. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>InheritBool value.</returns> public InheritBool GetBackDraw(PaletteState state) { return(_parent.GetBorderDraw(state)); }
/// <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);
/// <summary> /// Populate values from the base palette. /// </summary> /// <param name="state">Palette state to use when populating.</param> public void PopulateFromBase(PaletteState state) => TextColor = GetRibbonTextColor(state);
/// <summary> /// Gets the font for the long text by generating a new font instance. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Font value.</returns> public Font GetContentShortTextNewFont(PaletteState state) { return(RibbonGeneral.GetRibbonTextFont(state)); }
/// <summary> /// Populate values from the base palette. /// </summary> /// <param name="state">State to use when pulling values.</param> public void PopulateFromBase(PaletteState state) { _back.PopulateFromBase(state); _border.PopulateFromBase(state); }
/// <summary> /// Gets the content image. /// </summary> /// <param name="state">The state for which the image is needed.</param> /// <returns>Image value.</returns> public override Image GetImage(PaletteState state) { return(Page.GetImageMapping(Navigator.Stack.StackMapImage)); }
//ComponentFactory Palette Painting protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { //Define Bounds Rectangle ButtonBounds = new Rectangle(0, 0, 16, 16); RectangleF ButtonCircleBounds = new RectangleF((float)0, (float)0, (float)15.1, (float)15.1); //Smoothing Mode e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; //Paint Base base.OnPaint(e); if (_palette != null) { //Get the renderer associated with this palette IRenderer Renderer = _palette.GetRenderer(); //Create the rendering context that is passed into all renderer calls using (RenderContext RenderContext = new RenderContext(this, e.Graphics, ButtonBounds, Renderer)) { // Set the style we want picked up from the base palette m_paletteBack.Style = PaletteBackStyle.HeaderPrimary; //Fill The Space using (GraphicsPath Path = GetButtonPath(ButtonBounds)) { // Ask renderer to draw the background m_mementoBack1 = Renderer.RenderStandardBack.DrawBack(RenderContext, ButtonBounds, Path, m_paletteBack, m_orientation, (this.Enabled ? PaletteState.Normal : PaletteState.Disabled), m_mementoBack1); } // We want the inner part of the control to act like a button, so // we need to find the correct palette state based on if the mouse // is over the control if the mouse button is pressed down or not. PaletteState ButtonState = GetButtonState(); // Set the style of button we want to draw m_paletteBack.Style = m_visuallook; m_paletteBorder.Style = (PaletteBorderStyle)m_visuallook; m_paletteContent.Style = (PaletteContentStyle)m_visuallook; // Do we need to draw the background? if (m_paletteBack.GetBackDraw(ButtonState) == InheritBool.True) { using (GraphicsPath Path = GetRoundedSquarePath(ButtonCircleBounds)) { // Ask renderer to draw the background m_mementoBack2 = Renderer.RenderStandardBack.DrawBack(RenderContext, ButtonBounds, Path, m_paletteBack, m_orientation, ButtonState, m_mementoBack2); } } // Do we need to draw the border? if (m_paletteBorder.GetBorderDraw(ButtonState) == InheritBool.True) { // Now we draw the border of the inner area, also in ButtonStandalone style e.Graphics.DrawEllipse(new Pen(m_paletteBorder.GetBorderColor2(ButtonState)), ButtonCircleBounds); } e.Graphics.SmoothingMode = SmoothingMode.None; //Draw Magnifying Sign switch (m_buttonstyle) { case ButtonStyles.MinusButton: Rectangle MinusOuterBounds = new Rectangle(3, (this.Height / 2) - 2, 10, 4); Rectangle MinusInnerBounds = new Rectangle(4, (this.Height / 2) - 1, 8, 2); e.Graphics.FillRectangle(new SolidBrush(m_outerColor), MinusOuterBounds); e.Graphics.FillRectangle(new SolidBrush(m_innerColor), MinusInnerBounds); break; case ButtonStyles.PlusButton: DrawPlusOuter(e.Graphics, m_outerColor); DrawPlusInner(e.Graphics, m_innerColor); break; } } } }
/// <summary> /// Internal rendering method. /// </summary> protected virtual void DrawGrabHandleGlyph(RenderContext context, Rectangle displayRect, Orientation orientation, PaletteState state) { // Is there enough room to draw the at least one grab handle? if ((displayRect.Height >= _grabSquareMinSpace) && (displayRect.Width >= _grabSquareMinSpace)) { // Reduce rectangle to remove the border around the display area edges displayRect.Inflate(-_grabSquareGap, -_grabSquareGap); // Find how much space is available for drawing grab handles in the orientation int orientationSpace = (orientation == Orientation.Horizontal ? displayRect.Width : displayRect.Height); // Try to display the maximum allowed number of handles, but show less if not possible for (int i = _grabSquareCount; i > 0; i--) { // Calculate how much space this number of grab handles takes up int requiredSpace = (i * _grabSquareTotal) + (i > 1 ? (i - 1) * _grabSquareGap : 0); // Is there enough space all the grab handles? if (requiredSpace <= orientationSpace) { // Find offset before showing the first handle int offset = (orientationSpace - requiredSpace) / 2; Point draw; // Find location of first handle if (orientation == Orientation.Horizontal) { draw = new Point(displayRect.X + offset, displayRect.Y + (displayRect.Height - _grabSquareTotal) / 2); } else { draw = new Point(displayRect.X + (displayRect.Width - _grabSquareTotal) / 2, displayRect.Y + offset); } using (Brush lightBrush = new SolidBrush(_grabHandleLight), darkBrush = new SolidBrush(_grabHandleDark)) { // Draw each grab handle in turn for (int j = 0; j < i; j++) { // Draw the light colored square context.Graphics.FillRectangle(lightBrush, draw.X + _grabSquareOffset, draw.Y + _grabSquareOffset, _grabSquareLength, _grabSquareLength); // Draw the dark colored square overlapping the dark context.Graphics.FillRectangle(darkBrush, draw.X, draw.Y, _grabSquareLength, _grabSquareLength); // Move to the next handle position if (orientation == Orientation.Horizontal) { draw.X += _grabSquareTotal + _grabSquareGap; } else { draw.Y += _grabSquareTotal + _grabSquareGap; } } } // Finished break; } } } }
/// <summary> /// Gets the background drawing style for the ribbon item. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Color value.</returns> public PaletteRibbonColorStyle GetRibbonBackColorStyle(PaletteState state) { return(_inherit.GetRibbonBackColorStyle(state)); }
/// <summary> /// Gets the color drawing style for the short text. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Color drawing style.</returns> public virtual PaletteColorStyle GetContentShortTextColorStyle(PaletteState state) { return(PaletteColorStyle.Solid); }
/// <summary> /// Populate values from the base palette. /// </summary> /// <param name="state">Palette state to use when populating.</param> public void PopulateFromBase(PaletteState state) { Back.PopulateFromBase(state); Border.PopulateFromBase(state); Content.PopulateFromBase(state); }
/// <summary> /// Gets the color to use in place of the image map color. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Color value.</returns> public virtual Color GetContentImageColorTo(PaletteState state) { return(Color.Empty); }
/// <summary> /// Gets the color drawing style. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Color drawing style.</returns> public PaletteColorStyle GetBackColorStyle(PaletteState state) { return(_parent.GetBorderColorStyle(state)); }
/// <summary> /// Populate values from the base palette. /// </summary> /// <param name="state">Palette state to use when populating.</param> public void PopulateFromBase(PaletteState state) { Item.PopulateFromBase(state); }
/// <summary> /// Gets the background drawing style for the ribbon item. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <param name="style">Style of the ribbon back style requested.</param> /// <returns>Color value.</returns> public override PaletteRibbonColorStyle GetRibbonBackColorStyle(PaletteRibbonBackStyle style, PaletteState state) { IPaletteRibbonBack inherit = GetBackInherit(state); if (inherit != null) { return(inherit.GetRibbonBackColorStyle(state)); } else { return(Target.GetRibbonBackColorStyle(style, state)); } }
/// <summary> /// Gets the fifth background color for the ribbon item. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Color value.</returns> public abstract Color GetRibbonBackColor5(PaletteState state);
/// <summary> /// Gets the color alignment for the short text. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Color alignment style.</returns> public virtual PaletteRectangleAlign GetContentShortTextColorAlign(PaletteState state) { return(PaletteRectangleAlign.Local); }
/// <summary> /// Gets the vertical relative alignment of the short text. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>RelativeAlignment value.</returns> public virtual PaletteRelativeAlign GetContentShortTextV(PaletteState state) { return(PaletteRelativeAlign.Center); }
/// <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);
/// <summary> /// Gets the color background angle for the short text. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Angle used for color drawing.</returns> public virtual float GetContentShortTextColorAngle(PaletteState state) { return(0f); }
/// <summary> /// Perform layout calculations on the provided content. /// </summary> /// <param name="context">Layout context.</param> /// <param name="availableRect">Space available for laying out.</param> /// <param name="palette">Content palette details.</param> /// <param name="values">Content values.</param> /// <param name="orientation">Visual orientation of the content.</param> /// <param name="state">State associated with rendering.</param> /// <param name="composition">Drawing onto a composition element.</param> /// <param name="glowing">If composition, should glowing be drawn.</param> /// <returns>Memento with cached information.</returns> public abstract IDisposable LayoutContent(ViewLayoutContext context, Rectangle availableRect, IPaletteContent palette, IContentValues values, VisualOrientation orientation, PaletteState state, bool composition, bool glowing);
/// <summary> /// Gets the image alignment style. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Image alignment style.</returns> public PaletteRectangleAlign GetBackImageAlign(PaletteState state) { return(_parent.GetBorderImageAlign(state)); }