Skip to content

Commit

Permalink
Minor Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiizor committed Dec 10, 2024
1 parent f461096 commit 687e5b3
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 17 deletions.
13 changes: 13 additions & 0 deletions README.ES.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,19 @@ Gracias a estas personas maravillosas ([emoji clave](https://allcontributors.org
<a href="https://github.com/Taiizor/ReaLTaiizor/commits?author=toolgood" title="Solicitudes de Extracción Revisadas">👀</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/gmono">
<img src="https://avatars3.githubusercontent.com/u/19236339?s=460&v=4" width="80px;" alt="gmono" />
<br />
<sub>
<b>gmono</b>
</sub>
</a>
<br />
<a href="https://github.com/Taiizor/ReaLTaiizor/commits?author=gmono" title="Solicitudes de Extracción Revisadas">👀</a>
</td>
</tr>
</table>

Este proyecto sigue la especificación de [todos los contribuyentes](https://github.com/all-contributors/all-contributors). ¡Contribuciones de cualquier tipo de bienvenida!
Expand Down
13 changes: 13 additions & 0 deletions README.TR.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,19 @@ Bu harika insanlara teşekkürler ([emoji anahtarı](https://allcontributors.org
<a href="https://github.com/Taiizor/ReaLTaiizor/commits?author=toolgood" title="İncelenen Çekme İstekleri">👀</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/gmono">
<img src="https://avatars3.githubusercontent.com/u/19236339?s=460&v=4" width="80px;" alt="gmono" />
<br />
<sub>
<b>gmono</b>
</sub>
</a>
<br />
<a href="https://github.com/Taiizor/ReaLTaiizor/commits?author=gmono" title="İncelenen Çekme İstekleri">👀</a>
</td>
</tr>
</table>

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!
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,19 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<a href="https://github.com/Taiizor/ReaLTaiizor/commits?author=toolgood" title="Reviewed Pull Requests">👀</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/gmono">
<img src="https://avatars3.githubusercontent.com/u/19236339?s=460&v=4" width="80px;" alt="gmono" />
<br />
<sub>
<b>gmono</b>
</sub>
</a>
<br />
<a href="https://github.com/Taiizor/ReaLTaiizor/commits?author=gmono" title="Reviewed Pull Requests">👀</a>
</td>
</tr>
</table>

This project follows the [all contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
Expand Down
54 changes: 39 additions & 15 deletions src/ReaLTaiizor/Controls/ListBox/ForeverListBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -35,10 +37,10 @@ private ListBox ListBx
}
}

private string[] _items = { "" };
private string[] _items = Array.Empty<string>();

[Category("Options")]
public string[] items
public string[] Items
{
get => _items;
set
Expand All @@ -50,21 +52,37 @@ public string[] items
}
}

public object[] ListItems
public object ListSelectedItem
{
get
{
return ListBx.Items.Cast<object>().OfType<object>().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
{
Expand All @@ -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;
}
}
}

Expand All @@ -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;
}
Expand All @@ -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)
Expand All @@ -133,6 +158,7 @@ public void Drawitem(object sender, DrawItemEventArgs e)
protected override void OnCreateControl()
{
base.OnCreateControl();

if (!Controls.Contains(ListBx))
{
Controls.Add(ListBx);
Expand All @@ -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);
}

Expand All @@ -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;
Expand Down Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion src/ReaLTaiizor/ReaLTaiizor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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---------|
Expand Down
2 changes: 1 addition & 1 deletion src/ReaLTaiizor_CR/Catcher.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 687e5b3

Please sign in to comment.