diff --git a/Documents/Help/Changelog.md b/Documents/Help/Changelog.md index f659d8000..b7f15a7c7 100644 --- a/Documents/Help/Changelog.md +++ b/Documents/Help/Changelog.md @@ -5,6 +5,7 @@ ======= ## 2023-11-xx - Build 2311 - November 2023 +* Fixed the display of the initial selected theme in the "ThemeSelection ComboBox" * Resolved [#876](https://github.com/Krypton-Suite/Standard-Toolkit/issues/876), `Office 365 - Black` does not display text correctly * Resolved [#874](https://github.com/Krypton-Suite/Standard-Toolkit/issues/874), 80.xx Canary Nuget text is incorrrect * Implemented [#866](https://github.com/Krypton-Suite/Standard-Toolkit/issues/866), `KryptonMessageBox` Option to use system icons diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonPalette.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonPalette.cs index 16d657979..df0db2d8f 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonPalette.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonPalette.cs @@ -2590,7 +2590,7 @@ public void Reset() [KryptonPersist(false, false)] [Category(@"Visuals")] [Description(@"Base palette used to inherit from.")] - [DefaultValue(typeof(PaletteMode), "Office365Blue")] + [DefaultValue(typeof(PaletteMode), "Microsoft365Blue")] public PaletteMode BasePaletteMode { get => _basePaletteMode; diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonThemeComboBox.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonThemeComboBox.cs index 801bc1370..96c12bb54 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonThemeComboBox.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonThemeComboBox.cs @@ -20,24 +20,33 @@ public class KryptonThemeComboBox : KryptonComboBox { #region Instance Fields private readonly List _supportedThemesList; - private int _selectedIndex; - - private PaletteModeManager _paletteModeManager; #endregion #region Properties + [EditorBrowsable(EditorBrowsableState.Never)] public List SupportedThemesList => _supportedThemesList; - [DefaultValue(22)] + /// + /// Gets and sets the ThemeSelectedIndex. + /// + [Category(@"Visuals")] + [Description(@"Theme Selected Index. (Default = `Office 365 - Blue`)")] + [DefaultValue(25)] public int ThemeSelectedIndex { get => _selectedIndex; - set => _selectedIndex = value; + set => SelectedIndex = value; } + private void ResetThemeSelectedIndex() => _selectedIndex = 25; + + private bool ShouldSerializeThemeSelectedIndex() => _selectedIndex != 25; + + + [EditorBrowsable(EditorBrowsableState.Never)] public KryptonManager Manager { get; @@ -53,9 +62,8 @@ public KryptonThemeComboBox() { DropDownStyle = ComboBoxStyle.DropDownList; - ThemeSelectedIndex = 22; - _supportedThemesList = ThemeManager.PropagateSupportedThemeList(); + _selectedIndex = 25; } #endregion @@ -73,17 +81,9 @@ public KryptonThemeComboBox() protected override void OnCreateControl() { - if (!DesignMode) - { - Items.AddRange(ThemeManager.ReturnThemeArray()); - } - - Text = Manager.GlobalPaletteMode.ToString(); - - - _paletteModeManager = Manager.GlobalPaletteMode; - base.OnCreateControl(); + Items.AddRange(ThemeManager.ReturnThemeArray()); + SelectedIndex = _selectedIndex; } protected override void OnSelectedIndexChanged(EventArgs e) @@ -96,5 +96,59 @@ protected override void OnSelectedIndexChanged(EventArgs e) } #endregion + + #region Removed Designer visibility + /// + /// Gets and sets the text associated associated with the control. + /// + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public override string Text + { + get => base.Text; + set => base.Text = value; + } + + /// + /// Gets and sets the appearance and functionality of the KryptonComboBox. + /// + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new ComboBoxStyle DropDownStyle + { + get => base.DropDownStyle; + set => base.DropDownStyle = value; + } + + /// + /// Gets or sets the items in the KryptonComboBox. + /// + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new ComboBox.ObjectCollection Items => base.Items; + + /// Gets or sets the draw mode of the combobox. + /// The draw mode of the combobox. + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new DrawMode DrawMode + { + get => base.DrawMode; + set => base.DrawMode = value; + } + + /// + /// Gets or sets the StringCollection to use when the AutoCompleteSource property is set to CustomSource. + /// + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new AutoCompleteStringCollection AutoCompleteCustomSource + { + get => base.AutoCompleteCustomSource; + set => base.AutoCompleteCustomSource = value; + } + + #endregion } + } \ No newline at end of file diff --git a/Source/Krypton Components/Krypton.Toolkit/General/OperationThread.cs b/Source/Krypton Components/Krypton.Toolkit/General/OperationThread.cs index f8a649f67..8c7b7da74 100644 --- a/Source/Krypton Components/Krypton.Toolkit/General/OperationThread.cs +++ b/Source/Krypton Components/Krypton.Toolkit/General/OperationThread.cs @@ -44,7 +44,7 @@ public OperationThread(Operation op, object parameter) /// public int State { - get + get { int ret; @@ -54,7 +54,7 @@ public int State ret = _state; } - return ret; + return ret; } } @@ -82,18 +82,18 @@ public void Run() Result = _op(_parameter); // Success - lock(this) + lock (this) { _state = 1; } } - catch(Exception ex) + catch (Exception ex) { // Remember the exception details Exception = ex; // Failed with exception - lock(this) + lock (this) { _state = 2; } diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteCueHintText.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteCueHintText.cs index cb38a9f3b..9c8457feb 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteCueHintText.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteCueHintText.cs @@ -28,9 +28,7 @@ public PaletteCueHintText(PaletteRedirect redirect, NeedPaintHandler needPaint) : base(new PaletteContentInheritRedirect(redirect, PaletteContentStyle.InputControlStandalone), needPaint) { - _padding = Padding.Empty; _shortTextV = PaletteRelativeAlign.Center; - _shortTextH = PaletteRelativeAlign.Near; _contentTextHint = PaletteTextHint.AntiAlias; } @@ -58,7 +56,7 @@ public PaletteCueHintText(PaletteRedirect redirect, [KryptonPersist(false)] [Category(@"Visuals")] [Description(@"Text rendering hint for the content text. (No `Inherit`)")] - [DefaultValue(typeof(PaletteTextHint), "AntiAlias")] + [DefaultValue(PaletteTextHint.AntiAlias)] [RefreshProperties(RefreshProperties.All)] public virtual PaletteTextHint Hint { @@ -74,20 +72,17 @@ public virtual PaletteTextHint Hint } } - private bool ShouldSerializeHint() => _contentTextHint != PaletteTextHint.Inherit; + private bool ShouldSerializeHint() => _contentTextHint != PaletteTextHint.AntiAlias; /// /// Resets the Image property to its default value. /// - private void ResetHint() => _contentTextHint = PaletteTextHint.Inherit; + private void ResetHint() => _contentTextHint = PaletteTextHint.AntiAlias; #endregion - public override bool IsDefault => - (Font == null) && - (Color1 == Color.Empty) && - Padding.Equals(Padding.Empty) // <- This is not the same as the base - && (TextH == PaletteRelativeAlign.Near) // <- This is not the same as the base + /// + public override bool IsDefault => base.IsDefault && string.IsNullOrWhiteSpace(CueHintText) && (_shortTextV == PaletteRelativeAlign.Center) && !ShouldSerializeHint(); @@ -119,7 +114,7 @@ public override Font GetContentShortTextNewFont(PaletteState state) /// /// Palette value should be applicable to this state. /// Color value. - public new Color GetContentShortTextColor1(PaletteState state) => Color1 != Color.Empty ? Color1 : ControlPaint.Light(Inherit.GetContentShortTextColor1(state)); + public new Color GetContentShortTextColor1(PaletteState state) => !Color1.IsEmpty ? Color1 : ControlPaint.Light(Inherit.GetContentShortTextColor1(state)); internal void PerformPaint(VisualControlBase textBox, Graphics g, PI.RECT rect, SolidBrush backBrush) { @@ -202,31 +197,6 @@ public PaletteRelativeAlign TextV private void ResetTextV() => _shortTextV = PaletteRelativeAlign.Center; - /// - /// Gets and sets the horizontal Content text alignment for the text. - /// - [KryptonPersist(false)] - [Category(@"Visuals")] - [Description(@"Relative horizontal Content text alignment")] - [RefreshProperties(RefreshProperties.All)] - [DefaultValue(PaletteRelativeAlign.Near)] - public override PaletteRelativeAlign TextH - { - get => _shortTextH; - - set - { - if (value != _shortTextH) - { - _shortTextH = value; - PerformNeedPaint(); - } - } - } - private bool ShouldSerializeTextH() => _shortTextH != PaletteRelativeAlign.Near; - - private void ResetTextH() => _shortTextH = PaletteRelativeAlign.Near; - /// /// Gets the actual content short text vertical alignment value. /// @@ -234,34 +204,6 @@ public override PaletteRelativeAlign TextH /// RelativeAlignment value. public override PaletteRelativeAlign GetContentShortTextV(PaletteState state) => _shortTextV != PaletteRelativeAlign.Inherit ? _shortTextH : Inherit.GetContentShortTextV(state); - #endregion - - #region Padding - /// - /// Gets the padding between the border and content drawing. - /// - [KryptonPersist(false)] - [Category(@"Visuals")] - [Description(@"Padding between the border and content drawing.")] - [DefaultValue(typeof(Padding), "0")] - public new Padding Padding - { - get => _padding; - - set - { - if (!value.Equals(_padding)) - { - _padding = value; - PerformNeedPaint(true); - } - } - } - - private bool ShouldSerializePadding() => !_padding.Equals(Padding.Empty); - - private void ResetPadding() => _padding = Padding.Empty; - // Use the base class //protected virtual Padding GetContentPadding(PaletteState state) => !_padding.Equals(CommonHelper.InheritPadding) ? _padding : Inherit.GetContentPadding(state); diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteInputControlContentStates.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteInputControlContentStates.cs index 1d4f47e49..33836b291 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteInputControlContentStates.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteInputControlContentStates.cs @@ -58,7 +58,7 @@ public PaletteInputControlContentStates(IPaletteContent inherit, /// [Browsable(false)] public override bool IsDefault => (Font == null) && - (Color1 == Color.Empty) && + (Color1.IsEmpty) && Padding.Equals(CommonHelper.InheritPadding) && (TextH == PaletteRelativeAlign.Inherit) ; @@ -213,7 +213,7 @@ public virtual Font Font [Description(@"Relative horizontal Content text alignment\nIn order to get this into the designer.cs you must also modify another value in this area!")] [RefreshProperties(RefreshProperties.All)] [DefaultValue(PaletteRelativeAlign.Inherit)] - public virtual PaletteRelativeAlign TextH + public PaletteRelativeAlign TextH { get => _shortTextH; @@ -286,7 +286,7 @@ public virtual Color Color1 /// /// Palette value should be applicable to this state. /// Color value. - public Color GetContentShortTextColor1(PaletteState state) => _color1 != Color.Empty ? _color1 : Inherit.GetContentShortTextColor1(state); + public Color GetContentShortTextColor1(PaletteState state) => !_color1.IsEmpty ? _color1 : Inherit.GetContentShortTextColor1(state); /// /// Gets the second back color for the short text.