/// <summary> /// Initialize a new instance of the GraphicsHint class. /// </summary> /// <param name="graphics">Graphics context.</param> /// <param name="hint">Temporary hint mode to apply.</param> public GraphicsHint(Graphics graphics, PaletteGraphicsHint hint) { // Cache graphics instance _graphics = graphics; // Remember current smoothing mode _smoothingMode = _graphics.SmoothingMode; // Apply new hint switch (hint) { case PaletteGraphicsHint.None: _graphics.SmoothingMode = SmoothingMode.None; break; case PaletteGraphicsHint.AntiAlias: _graphics.SmoothingMode = SmoothingMode.AntiAlias; break; default: // Should never happen! Debug.Assert(false); break; } }
/// <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; }
/// <summary> /// Initialize a new instance of the PaletteBackInheritForced class. /// </summary> /// <param name="inherit">Background palette to inherit from.</param> public PaletteBackInheritForced(IPaletteBack inherit) { Debug.Assert(inherit != null); // Remember inheritance border _inherit = inherit; // Default values _borderIgnoreNormal = false; _forceGraphicsHint = PaletteGraphicsHint.Inherit; }
/// <summary> /// Initialize a new instance of the InternalStorage structure. /// </summary> public InternalStorage() { // Set to default values BackDraw = InheritBool.Inherit; BackGraphicsHint = PaletteGraphicsHint.Inherit; BackColor1 = Color.Empty; BackColor2 = Color.Empty; BackColorStyle = PaletteColorStyle.Inherit; BackColorAlign = PaletteRectangleAlign.Inherit; BackColorAngle = -1; BackImageStyle = PaletteImageStyle.Inherit; BackImageAlign = PaletteRectangleAlign.Inherit; }
/// <summary> /// Initialize a new instance of the InternalStorage structure. /// </summary> public InternalStorage() { // Set to default values BorderDraw = InheritBool.Inherit; BorderDrawBorders = PaletteDrawBorders.All; BorderGraphicsHint = PaletteGraphicsHint.Inherit; BorderColor1 = Color.Empty; BorderColor2 = Color.Empty; BorderColorStyle = PaletteColorStyle.Inherit; BorderColorAlign = PaletteRectangleAlign.Inherit; BorderColorAngle = -1; BorderWidth = -1; BorderRounding = -1; BorderImageStyle = PaletteImageStyle.Inherit; BorderImageAlign = PaletteRectangleAlign.Inherit; }
/// <summary> /// Gets the graphics drawing hint. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>PaletteGraphicsHint value.</returns> public override PaletteGraphicsHint GetBackGraphicsHint(PaletteState state) { if (Apply) { PaletteGraphicsHint ret = _primary.GetBackGraphicsHint(Override ? OverrideState : state); if (ret == PaletteGraphicsHint.Inherit) { ret = _backup.GetBackGraphicsHint(state); } return(ret); } else { return(_backup.GetBackGraphicsHint(state)); } }