diff --git a/Documents/Help/Changelog.md b/Documents/Help/Changelog.md index 6213db0b5..eff693a54 100644 --- a/Documents/Help/Changelog.md +++ b/Documents/Help/Changelog.md @@ -3,6 +3,7 @@ ======= ## 2023-11-xx - Build 2311 - November 2023 +* Implemented [#1023](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1023), Please remove "sealed" from `KryptonWrapLabel` and `KryptonLinkWrapLabel` * Added ability to embed links into the `KryptonMessageBox` content. The new options are:- - `ContentAreaType` - Defines content area type of a `KryptonMessageBox`, default is normal - `LinkLabelCommand` - Specifies a `KryptonCommand` if using the `MessageBoxContentAreaType.LinkLabel` type. diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonLanguageManager.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonLanguageManager.cs index b3d1c036d..952c5ec25 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonLanguageManager.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonLanguageManager.cs @@ -258,6 +258,7 @@ public class KryptonLanguageManager : Component private bool ShouldSerializePaletteContentStyleStrings() => !ContentStyleStrings.IsDefault; + /// Resets the palette content style strings. public void ResetPaletteContentStyleStrings() => ContentStyleStrings.Reset(); /// Gets the image effect strings. @@ -271,6 +272,7 @@ public class KryptonLanguageManager : Component private bool ShouldSerializePaletteImageEffectStrings() => !ImageEffectStrings.IsDefault; + /// Resets the palette image effect strings. public void ResetPaletteImageEffectStrings() => ImageEffectStrings.Reset(); /// Gets the image style strings. @@ -284,6 +286,7 @@ public class KryptonLanguageManager : Component private bool ShouldSerializePaletteImageStyleStrings() => !ImageStyleStrings.IsDefault; + /// Resets the palette image style strings. public void ResetPaletteImageStyleStrings() => ImageStyleStrings.Reset(); /// Gets the palette mode strings. @@ -311,6 +314,7 @@ public class KryptonLanguageManager : Component private bool ShouldSerializePaletteTextTrimStrings() => !TextTrimStrings.IsDefault; + /// Resets the palette text trim strings. public void ResetPaletteTextTrimStrings() => TextTrimStrings.Reset(); /// Gets the placement mode strings. @@ -324,6 +328,7 @@ public class KryptonLanguageManager : Component private bool ShouldSerializePlacementModeStrings() => !PlacementModeStrings.IsDefault; + /// Resets the placement mode strings. public void ResetPlacementModeStrings() => PlacementModeStrings.Reset(); /// Gets the separator style strings. @@ -337,6 +342,7 @@ public class KryptonLanguageManager : Component private bool ShouldSerializeSeparatorStyleStrings() => !SeparatorStyles.IsDefault; + /// Resets the separator style strings. public void ResetSeparatorStyleStrings() => SeparatorStyles.Reset(); /// Gets the tab border style strings. @@ -350,6 +356,7 @@ public class KryptonLanguageManager : Component private bool ShouldSerializeTabBorderStyleStrings() => !TabBorderStyles.IsDefault; + /// Resets the tab border style strings. public void ResetTabBorderStyleStrings() => TabBorderStyles.Reset(); /// Gets the tab style strings. @@ -363,8 +370,23 @@ public class KryptonLanguageManager : Component private bool ShouldSerializeTabStyleStrings() => !TabStyles.IsDefault; + /// Resets the tab style strings. public void ResetTabStyleStrings() => TabStyles.Reset(); + /// Gets the scrollbar strings. + /// The scrollbar strings. + [Category(@"Visuals")] + [Description(@"Collection of scrollbar strings.")] + [MergableProperty(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] + [Localizable(true)] + public KryptonScrollBarStrings KryptonScrollBarStrings => ScrollBarStrings; + + private bool ShouldSerializeKryptonScrollBarStrings() => !ScrollBarStrings.IsDefault; + + /// Resets the krypton scroll bar strings. + public void ResetKryptonScrollBarStrings() => ScrollBarStrings.Reset(); + #endregion #region Static Strings @@ -437,24 +459,42 @@ public class KryptonLanguageManager : Component /// The content style strings. public static PaletteContentStyleStrings ContentStyleStrings { get; } = new(); + /// Gets the image effect strings. + /// The image effect strings. public static PaletteImageEffectStrings ImageEffectStrings { get; } = new(); + /// Gets the image style strings. + /// The image style strings. public static PaletteImageStyleStrings ImageStyleStrings { get; } = new(); /// Gets the mode strings. /// The mode strings. public static PaletteModeStrings ModeStrings { get; } = new(); + /// Gets the text trim strings. + /// The text trim strings. public static PaletteTextTrimStrings TextTrimStrings { get; } = new(); + /// Gets the placement mode strings. + /// The placement mode strings. public static PlacementModeStrings PlacementModeStrings { get; } = new(); + /// Gets the separator styles. + /// The separator styles. public static SeparatorStyleStrings SeparatorStyles { get; } = new(); + /// Gets the tab border styles. + /// The tab border styles. public static TabBorderStyleStrings TabBorderStyles { get; } = new(); + /// Gets the tab styles. + /// The tab styles. public static TabStyleStrings TabStyles { get; } = new(); + /// Gets the scroll bar strings. + /// The scroll bar strings. + public static KryptonScrollBarStrings ScrollBarStrings { get; } = new(); + #endregion #region Identity @@ -497,7 +537,8 @@ public KryptonLanguageManager() ShouldSerializePlacementModeStrings() || ShouldSerializeSeparatorStyleStrings() || ShouldSerializeTabBorderStyleStrings() || - ShouldSerializeTabStyleStrings()); + ShouldSerializeTabStyleStrings() || + ShouldSerializeKryptonScrollBarStrings()); /// Resets this instance. public void Reset() @@ -549,6 +590,8 @@ public void Reset() ResetTabBorderStyleStrings(); ResetTabStyleStrings(); + + ResetKryptonScrollBarStrings(); } #endregion diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonLinkWrapLabel.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonLinkWrapLabel.cs index 3e9342293..7ce61a061 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonLinkWrapLabel.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonLinkWrapLabel.cs @@ -7,6 +7,7 @@ */ #endregion +// ReSharper disable VirtualMemberCallInConstructor namespace Krypton.Toolkit { /// @@ -20,10 +21,10 @@ namespace Krypton.Toolkit [Designer(typeof(KryptonLinkWrapLabelDesigner))] [DesignerCategory(@"code")] [Description(@"Displays descriptive information.")] - public sealed class KryptonLinkWrapLabel : LinkLabel + public class KryptonLinkWrapLabel : LinkLabel { #region Static Field - private static MethodInfo _miPTB; + private static MethodInfo? _miPtb; #endregion #region Instance Fields @@ -331,7 +332,7 @@ public PaletteBase? Palette if (_localPalette != value) { // Remember the starting palette - PaletteBase old = _localPalette; + PaletteBase? old = _localPalette; // Use the provided palette value SetPalette(value); @@ -425,7 +426,7 @@ public IRenderer? Renderer /// [Browsable(false)] [EditorBrowsable(EditorBrowsableState.Advanced)] - public ToolStripRenderer CreateToolStripRenderer() => Renderer.RenderToolStrip(GetResolvedPalette()); + public ToolStripRenderer? CreateToolStripRenderer() => Renderer?.RenderToolStrip(GetResolvedPalette()); /// /// Update the font property. @@ -434,7 +435,7 @@ public IRenderer? Renderer [EditorBrowsable(EditorBrowsableState.Never)] public void UpdateFont() { - Font font; + Font? font; Color textColor; PaletteTextHint hint; PaletteState ps = PaletteState.Normal; @@ -526,7 +527,7 @@ private void OnPaletteChanged(EventArgs e) // Layout and repaint with new settings NeedPaint(true); - PaletteChanged?.Invoke(this, e); + PaletteChanged.Invoke(this, e); } /// @@ -535,7 +536,7 @@ private void OnPaletteChanged(EventArgs e) /// An EventArgs containing the event data. protected override void OnPaint(PaintEventArgs e) { - Font font; + Font? font; Color textColor; PaletteTextHint hint; PaletteState ps = PaletteState.Normal; @@ -594,27 +595,33 @@ protected override void OnPaint(PaintEventArgs e) /// Raises the PaintBackground event. /// /// An PaintEventArgs containing the event data. - protected override void OnPaintBackground(PaintEventArgs pEvent) + protected override void OnPaintBackground(PaintEventArgs? pEvent) { // Do we have a parent control and we need to paint background? if (Parent != null) { // Only grab the required reference once - if (_miPTB == null) + if (_miPtb == null) { // Use reflection so we can call the Windows Forms internal method for painting parent background - _miPTB = typeof(Control).GetMethod("PaintTransparentBackground", + _miPtb = typeof(Control).GetMethod("PaintTransparentBackground", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, CallingConventions.HasThis, new[] { typeof(PaintEventArgs), typeof(Rectangle), typeof(Region) }, null); } - _miPTB.Invoke(this, new object[] { pEvent, ClientRectangle, null }); + if (pEvent != null) + { + _miPtb?.Invoke(this, new object[] { pEvent, ClientRectangle, null }); + } } else { - base.OnPaintBackground(pEvent); + if (pEvent != null) + { + base.OnPaintBackground(pEvent); + } } } @@ -791,7 +798,7 @@ private void SetPalette(PaletteBase? palette) _palette = palette; // Get the renderer associated with the palette - Renderer = _palette.GetRenderer(); + Renderer = _palette?.GetRenderer(); // Hook to new palette events if (_palette != null) @@ -806,7 +813,7 @@ private void SetPalette(PaletteBase? palette) private void OnPaletteNeedPaint(object sender, NeedLayoutEventArgs e) => NeedPaint(e); // Change in base renderer or base palette require we fetch the latest renderer - private void OnBaseChanged(object sender, EventArgs e) => Renderer = _palette.GetRenderer(); + private void OnBaseChanged(object sender, EventArgs e) => Renderer = _palette?.GetRenderer(); /// Called when [global palette changed]. /// The sender. diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonMessageBox.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonMessageBox.cs index c22059c5e..df061a92e 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonMessageBox.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonMessageBox.cs @@ -423,4 +423,4 @@ private static DialogResult ShowCore(IWin32Window? owner, #endregion } -} +} \ No newline at end of file diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonScrollBar.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonScrollBar.cs index f61645272..4a161081f 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonScrollBar.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonScrollBar.cs @@ -10,6 +10,7 @@ */ #endregion +// ReSharper disable CompareOfFloatsByEqualityOperator namespace Krypton.Toolkit { /// @@ -22,7 +23,7 @@ namespace Krypton.Toolkit [DesignerCategory(@"code")] public class KryptonScrollBar : Control { - #region fields + #region Instance Fields /// /// Indicates many changes to the scrollbar are happening, so stop painting till finished. @@ -75,7 +76,7 @@ public class KryptonScrollBar : Control private Color _borderColor = Color.FromArgb(93, 140, 201); private Color _disabledBorderColor = Color.Gray; - #region context menu items + #region Context Menu Items private ContextMenuStrip _contextMenu; private IContainer components; @@ -94,7 +95,7 @@ public class KryptonScrollBar : Control #endregion - #region constructor + #region Identity /// /// Initializes a new instance of the class. @@ -134,7 +135,7 @@ public KryptonScrollBar() #endregion - #region events + #region Events /// /// Occurs when the scrollbar scrolled. /// @@ -143,7 +144,7 @@ public KryptonScrollBar() public event ScrollEventHandler Scroll; #endregion - #region properties + #region Public /// /// Gets or sets the orientation. @@ -426,7 +427,7 @@ public double Opacity #region Implementation - #region public methods + #region Public Methods /// /// Prevents the drawing of the control until is called. @@ -450,7 +451,7 @@ public void EndUpdate() #endregion - #region protected methods + #region Protected Methods /// /// Raises the event. @@ -458,7 +459,7 @@ public void EndUpdate() /// The that contains the event data. protected virtual void OnScroll(ScrollEventArgs e) => // if event handler is attached - raise scroll event - Scroll?.Invoke(this, e); + Scroll.Invoke(this, e); /// /// Paints the background of the control. @@ -801,17 +802,17 @@ protected override void OnMouseMove(MouseEventArgs e) arrowSize = _arrowWidth; } - var perc = 0f; + var percent = 0f; if (pixelRange != 0) { // percent of the new position - perc = (float)(thumbPos - arrowSize) / (float)pixelRange; + percent = (thumbPos - arrowSize) / (float)pixelRange; } // the new value is somewhere between max and min, starting // at min position - _value = Convert.ToInt32((perc * (_maximum - _minimum)) + _minimum); + _value = Convert.ToInt32((percent * (_maximum - _minimum)) + _minimum); } // raise scroll event if new value different @@ -999,7 +1000,7 @@ protected override void OnEnabledChanged(EventArgs e) #endregion - #region misc methods + #region Misc Methods /// /// Sets up the scrollbar. @@ -1216,7 +1217,7 @@ private int GetThumbPosition() if (realRange != 0) { - perc = ((float)_value - (float)_minimum) / (float)realRange; + perc = (_value - _minimum) / (float)realRange; } return Math.Max(_thumbTopLimit, Math.Min( @@ -1239,9 +1240,9 @@ private int GetThumbSize() return trackSize; } - var newThumbSize = (float)_largeChange * (float)trackSize / (float)_maximum; + var newThumbSize = _largeChange * trackSize / (float)_maximum; - return Convert.ToInt32(Math.Min((float)trackSize, Math.Max(newThumbSize, 10f))); + return Convert.ToInt32(Math.Min(trackSize, Math.Max(newThumbSize, 10f))); } /// @@ -1382,27 +1383,27 @@ private void ChangeContextMenuItems() { _tsmiTop.Text = nameof(Top); _tsmiBottom.Text = nameof(Bottom); - _tsmiLargeDown.Text = "Page down"; - _tsmiLargeUp.Text = "Page up"; - _tsmiSmallDown.Text = "Scroll down"; - _tsmiSmallUp.Text = "Scroll up"; - _tsmiScrollHere.Text = "Scroll here"; + _tsmiLargeDown.Text = KryptonLanguageManager.ScrollBarStrings.PageDown; + _tsmiLargeUp.Text = KryptonLanguageManager.ScrollBarStrings.PageUp; + _tsmiSmallDown.Text = KryptonLanguageManager.ScrollBarStrings.ScrollDown; + _tsmiSmallUp.Text = KryptonLanguageManager.ScrollBarStrings.ScrollUp; + _tsmiScrollHere.Text = KryptonLanguageManager.ScrollBarStrings.ScrollHere; } else { _tsmiTop.Text = nameof(Left); _tsmiBottom.Text = nameof(Right); - _tsmiLargeDown.Text = "Page left"; - _tsmiLargeUp.Text = "Page right"; - _tsmiSmallDown.Text = "Scroll right"; - _tsmiSmallUp.Text = "Scroll left"; - _tsmiScrollHere.Text = "Scroll here"; + _tsmiLargeDown.Text = KryptonLanguageManager.ScrollBarStrings.PageLeft; + _tsmiLargeUp.Text = KryptonLanguageManager.ScrollBarStrings.PageRight; + _tsmiSmallDown.Text = KryptonLanguageManager.ScrollBarStrings.ScrollRight; + _tsmiSmallUp.Text = KryptonLanguageManager.ScrollBarStrings.ScrollLeft; + _tsmiScrollHere.Text = KryptonLanguageManager.ScrollBarStrings.ScrollHere; } } #endregion - #region context menu methods + #region Context Menu Methods /// /// Initializes the context menu. @@ -1445,7 +1446,7 @@ private void InitializeComponent() _tsmiScrollHere.DisplayStyle = ToolStripItemDisplayStyle.Text; _tsmiScrollHere.Name = nameof(_tsmiScrollHere); _tsmiScrollHere.Size = new Size(150, 22); - _tsmiScrollHere.Text = "Scroll here"; + _tsmiScrollHere.Text = KryptonLanguageManager.ScrollBarStrings.ScrollHere; _tsmiScrollHere.Click += ScrollHereClick; // // toolStripSeparator1 @@ -1479,7 +1480,7 @@ private void InitializeComponent() _tsmiLargeUp.DisplayStyle = ToolStripItemDisplayStyle.Text; _tsmiLargeUp.Name = nameof(_tsmiLargeUp); _tsmiLargeUp.Size = new Size(150, 22); - _tsmiLargeUp.Text = "Page up"; + _tsmiLargeUp.Text = KryptonLanguageManager.ScrollBarStrings.PageUp; _tsmiLargeUp.Click += LargeUpClick; // // tsmiLargeDown @@ -1487,7 +1488,7 @@ private void InitializeComponent() _tsmiLargeDown.DisplayStyle = ToolStripItemDisplayStyle.Text; _tsmiLargeDown.Name = nameof(_tsmiLargeDown); _tsmiLargeDown.Size = new Size(150, 22); - _tsmiLargeDown.Text = "Page down"; + _tsmiLargeDown.Text = KryptonLanguageManager.ScrollBarStrings.PageDown; _tsmiLargeDown.Click += LargeDownClick; // // toolStripSeparator3 @@ -1500,7 +1501,7 @@ private void InitializeComponent() _tsmiSmallUp.DisplayStyle = ToolStripItemDisplayStyle.Text; _tsmiSmallUp.Name = nameof(_tsmiSmallUp); _tsmiSmallUp.Size = new Size(150, 22); - _tsmiSmallUp.Text = "Scroll up"; + _tsmiSmallUp.Text = KryptonLanguageManager.ScrollBarStrings.ScrollUp; _tsmiSmallUp.Click += SmallUpClick; // // tsmiSmallDown @@ -1508,7 +1509,7 @@ private void InitializeComponent() _tsmiSmallDown.DisplayStyle = ToolStripItemDisplayStyle.Text; _tsmiSmallDown.Name = nameof(_tsmiSmallDown); _tsmiSmallDown.Size = new Size(150, 22); - _tsmiSmallDown.Text = "Scroll down"; + _tsmiSmallDown.Text = KryptonLanguageManager.ScrollBarStrings.ScrollDown; _tsmiSmallDown.Click += SmallDownClick; _contextMenu.ResumeLayout(false); ResumeLayout(false); @@ -1549,7 +1550,7 @@ private void ScrollHereClick(object sender, EventArgs e) if (pixelRange != 0) { - perc = (float)(thumbPos - arrowSize) / (float)pixelRange; + perc = (thumbPos - arrowSize) / (float)pixelRange; } var oldValue = _value; diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonWrapLabel.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonWrapLabel.cs index b82a1031f..f1e5f5c8b 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonWrapLabel.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonWrapLabel.cs @@ -10,6 +10,7 @@ */ #endregion +// ReSharper disable VirtualMemberCallInConstructor namespace Krypton.Toolkit { /// @@ -23,10 +24,10 @@ namespace Krypton.Toolkit [Designer(typeof(KryptonWrapLabelDesigner))] [DesignerCategory(@"code")] [Description(@"Displays descriptive information.")] - public sealed class KryptonWrapLabel : Label + public class KryptonWrapLabel : Label { #region Static Field - private static MethodInfo _miPTB; + private static MethodInfo? _miPtb; #endregion #region Instance Fields @@ -333,7 +334,7 @@ public PaletteBase? Palette if (_localPalette != value) { // Remember the starting palette - PaletteBase old = _localPalette; + PaletteBase? old = _localPalette; // Use the provided palette value SetPalette(value); @@ -427,7 +428,7 @@ public IRenderer? Renderer /// [Browsable(false)] [EditorBrowsable(EditorBrowsableState.Advanced)] - public ToolStripRenderer CreateToolStripRenderer() => Renderer.RenderToolStrip(GetResolvedPalette()); + public ToolStripRenderer? CreateToolStripRenderer() => Renderer?.RenderToolStrip(GetResolvedPalette()); /// /// Update the font property. @@ -436,7 +437,7 @@ public IRenderer? Renderer [EditorBrowsable(EditorBrowsableState.Never)] public void UpdateFont() { - Font font; + Font? font; Color textColor; PaletteTextHint hint; PaletteState ps = PaletteState.Normal; @@ -528,7 +529,7 @@ private void OnPaletteChanged(EventArgs e) // Layout and repaint with new settings NeedPaint(true); - PaletteChanged?.Invoke(this, e); + PaletteChanged.Invoke(this, e); } /// @@ -537,7 +538,7 @@ private void OnPaletteChanged(EventArgs e) /// An EventArgs containing the event data. protected override void OnPaint(PaintEventArgs e) { - Font font; + Font? font; Color textColor; PaletteTextHint hint; PaletteState ps = PaletteState.Normal; @@ -596,27 +597,33 @@ protected override void OnPaint(PaintEventArgs e) /// Raises the PaintBackground event. /// /// An PaintEventArgs containing the event data. - protected override void OnPaintBackground(PaintEventArgs pEvent) + protected override void OnPaintBackground(PaintEventArgs? pEvent) { // Do we have a parent control and we need to paint background? if (Parent != null) { // Only grab the required reference once - if (_miPTB == null) + if (_miPtb == null) { // Use reflection so we can call the Windows Forms internal method for painting parent background - _miPTB = typeof(Control).GetMethod("PaintTransparentBackground", + _miPtb = typeof(Control).GetMethod("PaintTransparentBackground", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, CallingConventions.HasThis, new[] { typeof(PaintEventArgs), typeof(Rectangle), typeof(Region) }, null); } - _miPTB.Invoke(this, new object[] { pEvent, ClientRectangle, null }); + if (pEvent != null) + { + _miPtb?.Invoke(this, new object[] { pEvent, ClientRectangle, null }); + } } else { - base.OnPaintBackground(pEvent); + if (pEvent != null) + { + base.OnPaintBackground(pEvent); + } } } @@ -793,7 +800,7 @@ private void SetPalette(PaletteBase? palette) _palette = palette; // Get the renderer associated with the palette - Renderer = _palette.GetRenderer(); + Renderer = _palette?.GetRenderer(); // Hook to new palette events if (_palette != null) @@ -808,7 +815,7 @@ private void SetPalette(PaletteBase? palette) private void OnPaletteNeedPaint(object sender, NeedLayoutEventArgs e) => NeedPaint(e); // Change in base renderer or base palette require we fetch the latest renderer - private void OnBaseChanged(object sender, EventArgs e) => Renderer = _palette.GetRenderer(); + private void OnBaseChanged(object sender, EventArgs e) => Renderer = _palette?.GetRenderer(); /// Called when [global palette changed]. /// The sender. diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/Action Lists/KryptonTextBoxActionList.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/Action Lists/KryptonTextBoxActionList.cs index 92b9d0bb1..9f0fa4209 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/Action Lists/KryptonTextBoxActionList.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/Action Lists/KryptonTextBoxActionList.cs @@ -15,7 +15,7 @@ namespace Krypton.Toolkit internal class KryptonTextBoxActionList : DesignerActionList { #region Instance Fields - private readonly KryptonTextBox _textBox; + private readonly KryptonTextBox? _textBox; private readonly IComponentChangeService _service; #endregion @@ -40,13 +40,13 @@ public KryptonTextBoxActionList(KryptonTextBoxDesigner owner) /// The Krypton Context Menu. public KryptonContextMenu? KryptonContextMenu { - get => _textBox.KryptonContextMenu; + get => _textBox?.KryptonContextMenu; set { - if (_textBox.KryptonContextMenu != value) + if (_textBox?.KryptonContextMenu != value) { - _service.OnComponentChanged(_textBox, null, _textBox.KryptonContextMenu, value); + _service.OnComponentChanged(_textBox, null, _textBox?.KryptonContextMenu, value); _textBox.KryptonContextMenu = value; } @@ -58,13 +58,13 @@ public KryptonContextMenu? KryptonContextMenu /// public PaletteMode PaletteMode { - get => _textBox.PaletteMode; + get => _textBox!.PaletteMode; set { - if (_textBox.PaletteMode != value) + if (_textBox?.PaletteMode != value) { - _service.OnComponentChanged(_textBox, null, _textBox.PaletteMode, value); + _service.OnComponentChanged(_textBox, null, _textBox?.PaletteMode, value); _textBox.PaletteMode = value; } } @@ -79,7 +79,7 @@ public InputControlStyle InputControlStyle set { - if (_textBox.InputControlStyle != value) + if (_textBox?.InputControlStyle != value) { _service.OnComponentChanged(_textBox, null, _textBox.InputControlStyle, value); _textBox.InputControlStyle = value; @@ -96,7 +96,7 @@ public bool Multiline set { - if (_textBox.Multiline != value) + if (_textBox?.Multiline != value) { _service.OnComponentChanged(_textBox, null, _textBox.Multiline, value); _textBox.Multiline = value; @@ -113,7 +113,7 @@ public bool WordWrap set { - if (_textBox.WordWrap != value) + if (_textBox?.WordWrap != value) { _service.OnComponentChanged(_textBox, null, _textBox.WordWrap, value); _textBox.WordWrap = value; @@ -130,7 +130,7 @@ public bool UseSystemPasswordChar set { - if (_textBox.UseSystemPasswordChar != value) + if (_textBox?.UseSystemPasswordChar != value) { _service.OnComponentChanged(_textBox, null, _textBox.UseSystemPasswordChar, value); _textBox.UseSystemPasswordChar = value; @@ -141,13 +141,13 @@ public bool UseSystemPasswordChar /// Gets or sets the hint. /// The hint. [Obsolete("Deprecated - Use CueHint.CueHintText")] - public string Hint + public string CueHintText { get => _textBox.CueHint.CueHintText; set { - if (_textBox.CueHint.CueHintText != value) + if (_textBox?.CueHint.CueHintText != value) { _service.OnComponentChanged(_textBox, null, _textBox.CueHint.CueHintText, value); @@ -158,13 +158,13 @@ public string Hint // Gets or sets the text box font. /// The text box font. - public Font Font + public Font? Font { - get => _textBox.StateCommon.Content.Font; + get => _textBox?.StateCommon.Content.Font; set { - if (_textBox.StateCommon.Content.Font != value) + if (_textBox?.StateCommon.Content.Font != value) { _service.OnComponentChanged(_textBox, null, _textBox.StateCommon.Content.Font, value); @@ -182,7 +182,7 @@ public float StateCommonCornerRoundingRadius set { - if (_textBox.StateCommon.Border.Rounding != value) + if (_textBox?.StateCommon.Border.Rounding != value) { _service.OnComponentChanged(_textBox, null, _textBox.StateCommon.Border.Rounding, value); @@ -215,7 +215,7 @@ public override DesignerActionItemCollection GetSortedActionItems() actions.Add(new DesignerActionPropertyItem(nameof(Multiline), nameof(Multiline), nameof(TextBox), @"Should text span multiple lines.")); actions.Add(new DesignerActionPropertyItem(nameof(WordWrap), nameof(WordWrap), nameof(TextBox), @"Should words be wrapped over multiple lines.")); actions.Add(new DesignerActionPropertyItem(nameof(UseSystemPasswordChar), nameof(UseSystemPasswordChar), nameof(TextBox), @"Should characters be Displayed in password characters.")); - actions.Add(new DesignerActionPropertyItem(nameof(Hint), nameof(Hint), nameof(TextBox), @"Sets the hint string for the textbox.")); + actions.Add(new DesignerActionPropertyItem(nameof(CueHintText), nameof(CueHintText), nameof(TextBox), @"Sets the hint string for the textbox.")); actions.Add(new DesignerActionHeaderItem(@"Visuals")); actions.Add(new DesignerActionPropertyItem(nameof(PaletteMode), @"Palette", @"Visuals", @"Palette applied to drawing")); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Translations/Miscellaneous/KryptonScrollBarStrings.cs b/Source/Krypton Components/Krypton.Toolkit/Translations/Miscellaneous/KryptonScrollBarStrings.cs index 8cdfd127b..eabb73f91 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Translations/Miscellaneous/KryptonScrollBarStrings.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Translations/Miscellaneous/KryptonScrollBarStrings.cs @@ -17,9 +17,13 @@ public class KryptonScrollBarStrings : GlobalId private const string DEFAULT_SCROLL_BAR_PAGE_DOWN = @"Page Down"; private const string DEFAULT_SCROLL_BAR_PAGE_UP = @"Page Up"; + private const string DEFAULT_SCROLL_BAR_PAGE_LEFT = @"Page Left"; + private const string DEFAULT_SCROLL_BAR_PAGE_RIGHT = @"Page Right"; private const string DEFAULT_SCROLL_BAR_SCROLL_DOWN = @"Scoll Down"; private const string DEFAULT_SCROLL_BAR_SCROLL_HERE = @"Scroll Here"; private const string DEFAULT_SCROLL_BAR_SCROLL_UP = @"Scroll Up"; + private const string DEFAULT_SCROLL_BAR_SCROLL_RIGHT = @"Scroll Right"; + private const string DEFAULT_SCROLL_BAR_SCROLL_LEFT = @"Scroll Left"; #endregion @@ -37,36 +41,104 @@ public KryptonScrollBarStrings() #region Public + /// Gets a value indicating whether this instance is default. + /// true if this instance is default; otherwise, false. [Browsable(false)] public bool IsDefault => PageDown.Equals(DEFAULT_SCROLL_BAR_PAGE_DOWN) && PageUp.Equals(DEFAULT_SCROLL_BAR_PAGE_UP) && + PageRight.Equals(DEFAULT_SCROLL_BAR_PAGE_RIGHT) && + PageLeft.Equals(DEFAULT_SCROLL_BAR_PAGE_LEFT) && ScrollDown.Equals(DEFAULT_SCROLL_BAR_SCROLL_DOWN) && ScrollHere.Equals(DEFAULT_SCROLL_BAR_SCROLL_HERE) && - ScrollUp.Equals(DEFAULT_SCROLL_BAR_SCROLL_UP); + ScrollUp.Equals(DEFAULT_SCROLL_BAR_SCROLL_UP) && + ScrollLeft.Equals(DEFAULT_SCROLL_BAR_SCROLL_LEFT) && + ScrollRight.Equals(DEFAULT_SCROLL_BAR_SCROLL_LEFT); + /// Resets this instance. public void Reset() { PageDown = DEFAULT_SCROLL_BAR_PAGE_DOWN; PageUp = DEFAULT_SCROLL_BAR_PAGE_UP; + PageLeft = DEFAULT_SCROLL_BAR_PAGE_LEFT; + + PageRight = DEFAULT_SCROLL_BAR_PAGE_RIGHT; + ScrollDown = DEFAULT_SCROLL_BAR_SCROLL_DOWN; ScrollHere = DEFAULT_SCROLL_BAR_SCROLL_HERE; ScrollUp = DEFAULT_SCROLL_BAR_SCROLL_UP; + + ScrollLeft = DEFAULT_SCROLL_BAR_SCROLL_LEFT; + + ScrollRight = DEFAULT_SCROLL_BAR_SCROLL_RIGHT; } + /// Gets or sets the scrollbar page down string. + [Category(@"Visuals")] + [Description(@"The scrollbar page down string.")] + [DefaultValue(DEFAULT_SCROLL_BAR_PAGE_DOWN)] + [RefreshProperties(RefreshProperties.All)] public string PageDown { get; set; } + /// Gets or sets the scrollbar page up string. + [Category(@"Visuals")] + [Description(@"The scrollbar page up string.")] + [DefaultValue(DEFAULT_SCROLL_BAR_PAGE_UP)] + [RefreshProperties(RefreshProperties.All)] public string PageUp { get; set; } + /// Gets or sets the scrollbar page right string. + [Category(@"Visuals")] + [Description(@"The scrollbar page right string.")] + [DefaultValue(DEFAULT_SCROLL_BAR_PAGE_RIGHT)] + [RefreshProperties(RefreshProperties.All)] + public string PageRight { get; set; } + + /// Gets or sets the scrollbar page left string. + [Category(@"Visuals")] + [Description(@"The scrollbar page left string.")] + [DefaultValue(DEFAULT_SCROLL_BAR_PAGE_LEFT)] + [RefreshProperties(RefreshProperties.All)] + public string PageLeft { get; set; } + + /// Gets or sets the scrollbar scroll down string. + [Category(@"Visuals")] + [Description(@"The scrollbar scroll down string.")] + [DefaultValue(DEFAULT_SCROLL_BAR_SCROLL_DOWN)] + [RefreshProperties(RefreshProperties.All)] public string ScrollDown { get; set; } + /// Gets or sets the scrollbar scroll here string. + [Category(@"Visuals")] + [Description(@"The scrollbar scroll here string.")] + [DefaultValue(DEFAULT_SCROLL_BAR_SCROLL_HERE)] + [RefreshProperties(RefreshProperties.All)] public string ScrollHere { get; set; } + /// Gets or sets the scrollbar scroll up string. + [Category(@"Visuals")] + [Description(@"The scrollbar scroll up string.")] + [DefaultValue(DEFAULT_SCROLL_BAR_SCROLL_UP)] + [RefreshProperties(RefreshProperties.All)] public string ScrollUp { get; set; } + /// Gets or sets the scrollbar scroll right string. + [Category(@"Visuals")] + [Description(@"The scrollbar scroll right string.")] + [DefaultValue(DEFAULT_SCROLL_BAR_SCROLL_RIGHT)] + [RefreshProperties(RefreshProperties.All)] + public string ScrollRight { get; set; } + + /// Gets or sets the scrollbar scroll left string. + [Category(@"Visuals")] + [Description(@"The scrollbar scroll left string.")] + [DefaultValue(DEFAULT_SCROLL_BAR_SCROLL_LEFT)] + [RefreshProperties(RefreshProperties.All)] + public string ScrollLeft { get; set; } + #endregion } } \ No newline at end of file