diff --git a/README.ES.md b/README.ES.md index e97cdab4..8e0ec885 100644 --- a/README.ES.md +++ b/README.ES.md @@ -102,6 +102,19 @@ Gracias a estas personas maravillosas ([emoji clave](https://allcontributors.org 👀 + + + + gmono +
+ + gmono + +
+
+ 👀 + + Este proyecto sigue la especificación de [todos los contribuyentes](https://github.com/all-contributors/all-contributors). ¡Contribuciones de cualquier tipo de bienvenida! diff --git a/README.TR.md b/README.TR.md index 729cf9a8..9fb50c2b 100644 --- a/README.TR.md +++ b/README.TR.md @@ -102,6 +102,19 @@ Bu harika insanlara teşekkürler ([emoji anahtarı](https://allcontributors.org 👀 + + + + gmono +
+ + gmono + +
+
+ 👀 + + Bu proje [tüm katkıda bulunanların](https://github.com/all-contributors/all-contributors) özelliklerini takip ediyor. Her türlü katkıda hoş geldiniz! diff --git a/README.md b/README.md index 94ebf3dd..04a040ef 100644 --- a/README.md +++ b/README.md @@ -102,6 +102,19 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d 👀 + + + + gmono +
+ + gmono + +
+
+ 👀 + + This project follows the [all contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! diff --git a/src/ReaLTaiizor/Controls/ListBox/ForeverListBox.cs b/src/ReaLTaiizor/Controls/ListBox/ForeverListBox.cs index 79664ced..944601e4 100644 --- a/src/ReaLTaiizor/Controls/ListBox/ForeverListBox.cs +++ b/src/ReaLTaiizor/Controls/ListBox/ForeverListBox.cs @@ -2,10 +2,12 @@ using ReaLTaiizor.Colors; using ReaLTaiizor.Util; +using System; using System.ComponentModel; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Text; +using System.Linq; using System.Windows.Forms; #endregion @@ -35,10 +37,10 @@ private ListBox ListBx } } - private string[] _items = { "" }; + private string[] _items = Array.Empty(); [Category("Options")] - public string[] items + public string[] Items { get => _items; set @@ -50,21 +52,37 @@ public string[] items } } - public object[] ListItems + public object ListSelectedItem { get { - return ListBx.Items.Cast().OfType().ToArray(); + if (Items.Any() && Items.Count() >= SelectedIndex) + { + return ListBx.Items[SelectedIndex]; + } + + return null; } } - public object ListSelectedItem => ListBx.Items[SelectedIndex]; - + [Category("Colors")] public Color SelectedColor { get; set; } = ForeverLibrary.ForeverColor; - public string SelectedItem => + public string SelectedItem + { + get + { //return ListBx.SelectedItem.ToString(); - (string)ListBx.Items[SelectedIndex]; + + if (Items.Any() && Items.Count() >= SelectedIndex) + { + return (string)ListSelectedItem; + } + + return string.Empty; + } + set => ListBx.SelectedItem = value; + } public int SelectedIndex { @@ -77,7 +95,14 @@ public int SelectedIndex return functionReturnValue; } - return functionReturnValue; + return ListBx.SelectedIndex; + } + set + { + if (Items.Any() && Items.Count() - 1 >= value && value >= 0) + { + ListBx.SelectedIndex = value; + } } } @@ -96,7 +121,7 @@ public void ClearSelected() public void Drawitem(object sender, DrawItemEventArgs e) { - if (e.Index < 0) + if (e.Index < 0 || !Items.Any()) { return; } @@ -106,8 +131,8 @@ public void Drawitem(object sender, DrawItemEventArgs e) e.Graphics.SmoothingMode = SmoothingMode.HighQuality; e.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; - e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit; + e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; //-- if selected if (e.State.ToString().IndexOf("Selected,") >= 0) @@ -133,6 +158,7 @@ public void Drawitem(object sender, DrawItemEventArgs e) protected override void OnCreateControl() { base.OnCreateControl(); + if (!Controls.Contains(ListBx)) { Controls.Add(ListBx); @@ -141,13 +167,11 @@ protected override void OnCreateControl() public void AddRange(object[] items) { - ListBx.Items.Remove(""); ListBx.Items.AddRange(items); } public void AddItem(object item) { - ListBx.Items.Remove(""); ListBx.Items.Add(item); } @@ -156,10 +180,11 @@ public void AddItem(object item) public ForeverListBox() { ListBx = new ListBox(); + SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true); DoubleBuffered = true; - ListBx.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; + ListBx.DrawMode = DrawMode.OwnerDrawFixed; ListBx.ScrollAlwaysVisible = false; ListBx.HorizontalScrollbar = false; ListBx.BorderStyle = BorderStyle.None; @@ -189,7 +214,6 @@ protected override void OnPaint(PaintEventArgs e) _with19.PixelOffsetMode = PixelOffsetMode.HighQuality; _with19.TextRenderingHint = TextRenderingHint.ClearTypeGridFit; _with19.Clear(BackColor); - //-- Size ListBx.Size = new(Width - 6, Height - 2); diff --git a/src/ReaLTaiizor/ReaLTaiizor.cs b/src/ReaLTaiizor/ReaLTaiizor.cs index 539d8df1..8bfd2f9b 100644 --- a/src/ReaLTaiizor/ReaLTaiizor.cs +++ b/src/ReaLTaiizor/ReaLTaiizor.cs @@ -13,7 +13,7 @@ // Creator: Taiizor // Website: www.vegalya.com // Created: 15.May.2019 -// Changed: 29.Nov.2024 +// Changed: 10.Dec.2024 // Version: 3.8.1.1 // // |---------DO-NOT-REMOVE---------| diff --git a/src/ReaLTaiizor_CR/Catcher.Designer.cs b/src/ReaLTaiizor_CR/Catcher.Designer.cs index 5bcdfcaf..f00bb676 100644 --- a/src/ReaLTaiizor_CR/Catcher.Designer.cs +++ b/src/ReaLTaiizor_CR/Catcher.Designer.cs @@ -157,7 +157,7 @@ private void InitializeComponent() // foreverListBox1 // this.foreverListBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(25)))), ((int)(((byte)(35))))); - this.foreverListBox1.items = new string[] { + this.foreverListBox1.Items = new string[] { "Item 1", "Item 2", "Item 3"};