random-file-runner/RyzStudio/Windows/ThemedForms/TextBox/TClearableTextBox.cs

43 lines
1.4 KiB
C#
Raw Permalink Normal View History

2021-10-24 15:49:48 +00:00
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using UIResources = RandomFileRunner.UIResource;
namespace RyzStudio.Windows.ThemedForms
{
public class TClearableTextBox : TButtonTextBox
{
public TClearableTextBox()
{
this.NormalImage = UIResources.trash;
this.HighlightImage = UIResources.trash2;
this.Text = string.Empty;
}
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new Image NormalImage { get => base.NormalImage; set => base.NormalImage = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new Image HighlightImage { get => base.HighlightImage; set => base.HighlightImage = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new Forms.TImageBox InnerImageBox { get => base.InnerImageBox; set => base.InnerImageBox = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new TextBox InnerTextBox { get => base.InnerTextBox; set => base.InnerTextBox = value; }
protected override void imageBox1_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button != MouseButtons.Left)
{
return;
}
this.Text = string.Empty;
}
}
}