解决了UITextBox粘贴会重复粘贴两次的Bug
This commit is contained in:
parent
361af57295
commit
1df5a5adac
BIN
Bin/SunnyUI.dll
BIN
Bin/SunnyUI.dll
Binary file not shown.
BIN
Bin/SunnyUI.pdb
BIN
Bin/SunnyUI.pdb
Binary file not shown.
Binary file not shown.
@ -54,7 +54,6 @@ namespace Sunny.UI
|
|||||||
edit.Text = String.Empty;
|
edit.Text = String.Empty;
|
||||||
edit.ForeColor = UIFontColor.Primary;
|
edit.ForeColor = UIFontColor.Primary;
|
||||||
edit.BorderStyle = BorderStyle.None;
|
edit.BorderStyle = BorderStyle.None;
|
||||||
edit.KeyDown += EditOnKeyDown;
|
|
||||||
edit.TextChanged += EditTextChanged;
|
edit.TextChanged += EditTextChanged;
|
||||||
edit.Invalidate();
|
edit.Invalidate();
|
||||||
Controls.Add(edit);
|
Controls.Add(edit);
|
||||||
@ -216,27 +215,6 @@ namespace Sunny.UI
|
|||||||
e.Graphics.DrawFontImage(dropSymbol, 24, color, Width - 28 + (12 - sf.Width / 2.0f), (Height - sf.Height) / 2.0f);
|
e.Graphics.DrawFontImage(dropSymbol, 24, color, Width - 28 + (12 - sf.Width / 2.0f), (Height - sf.Height) / 2.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EditOnKeyDown(object Obj, KeyEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.Control && e.KeyCode == Keys.A)
|
|
||||||
{
|
|
||||||
edit.SelectAll();
|
|
||||||
e.SuppressKeyPress = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.Control && e.KeyCode == Keys.C)
|
|
||||||
{
|
|
||||||
edit.Copy();
|
|
||||||
e.SuppressKeyPress = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.Control && e.KeyCode == Keys.V)
|
|
||||||
{
|
|
||||||
edit.Paste();
|
|
||||||
e.SuppressKeyPress = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnGotFocus(EventArgs e)
|
protected override void OnGotFocus(EventArgs e)
|
||||||
{
|
{
|
||||||
base.OnGotFocus(e);
|
base.OnGotFocus(e);
|
||||||
@ -332,7 +310,6 @@ namespace Sunny.UI
|
|||||||
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
||||||
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, string lParam);
|
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, string lParam);
|
||||||
|
|
||||||
|
|
||||||
[DefaultValue(null)]
|
[DefaultValue(null)]
|
||||||
public string Watermark
|
public string Watermark
|
||||||
{
|
{
|
||||||
|
@ -71,17 +71,6 @@ namespace Sunny.UI
|
|||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
base.OnKeyDown(e);
|
|
||||||
|
|
||||||
EditOnKeyDown(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool EnterAsTab { get; set; }
|
|
||||||
|
|
||||||
public event EventHandler EnterKeyPress;
|
|
||||||
|
|
||||||
private void EditOnKeyDown(KeyEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.Control && e.KeyCode == Keys.A)
|
if (e.Control && e.KeyCode == Keys.A)
|
||||||
{
|
{
|
||||||
SelectAll();
|
SelectAll();
|
||||||
@ -99,13 +88,21 @@ namespace Sunny.UI
|
|||||||
Paste();
|
Paste();
|
||||||
e.SuppressKeyPress = true;
|
e.SuppressKeyPress = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (e.Control && e.KeyCode == Keys.X)
|
||||||
|
{
|
||||||
|
Cut();
|
||||||
|
e.SuppressKeyPress = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
base.OnKeyDown(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
[
|
public bool EnterAsTab { get; set; }
|
||||||
DefaultValue(typeof(bool), "false"),
|
|
||||||
Category("Appearance"),
|
public event EventHandler EnterKeyPress;
|
||||||
Description("整型、浮点型可以为空")
|
|
||||||
]
|
[DefaultValue(false), Category("Appearance"), Description("整型、浮点型可以为空")]
|
||||||
public bool CanEmpty
|
public bool CanEmpty
|
||||||
{
|
{
|
||||||
get => canEmpty;
|
get => canEmpty;
|
||||||
|
@ -129,23 +129,23 @@ namespace Sunny.UI
|
|||||||
{
|
{
|
||||||
KeyDown?.Invoke(sender, e);
|
KeyDown?.Invoke(sender, e);
|
||||||
|
|
||||||
if (e.Control && e.KeyCode == Keys.A)
|
// if (e.Control && e.KeyCode == Keys.A)
|
||||||
{
|
// {
|
||||||
edit.SelectAll();
|
// edit.SelectAll();
|
||||||
e.SuppressKeyPress = true;
|
// e.SuppressKeyPress = true;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (e.Control && e.KeyCode == Keys.C)
|
// if (e.Control && e.KeyCode == Keys.C)
|
||||||
{
|
// {
|
||||||
edit.Copy();
|
// edit.Copy();
|
||||||
e.SuppressKeyPress = true;
|
// e.SuppressKeyPress = true;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (e.Control && e.KeyCode == Keys.V)
|
// if (e.Control && e.KeyCode == Keys.V)
|
||||||
{
|
// {
|
||||||
edit.Paste();
|
// edit.Paste();
|
||||||
e.SuppressKeyPress = true;
|
// e.SuppressKeyPress = true;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnGotFocus(EventArgs e)
|
protected override void OnGotFocus(EventArgs e)
|
||||||
|
@ -584,12 +584,11 @@ namespace Sunny.UI
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Color titleColor = rectColor;// IsDesignMode ? rectColor : IsActive ? rectColor : Color.From
|
Color showTitleColor = IsDesignMode || IsActive ? rectColor : Color.FromArgb(173, 178, 181);
|
||||||
//Argb(173, 178, 181);
|
|
||||||
|
|
||||||
if (ShowTitle)
|
if (ShowTitle)
|
||||||
{
|
{
|
||||||
e.Graphics.FillRectangle(new SolidBrush(titleColor), 0, 0, Width, TitleHeight);
|
e.Graphics.FillRectangle(showTitleColor, 0, 0, Width, TitleHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShowRect)
|
if (ShowRect)
|
||||||
@ -626,14 +625,14 @@ namespace Sunny.UI
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
e.Graphics.DrawLines(rectColor, points);
|
e.Graphics.DrawLines(showTitleColor, points);
|
||||||
|
|
||||||
if (!unShowRadius)
|
if (!unShowRadius)
|
||||||
{
|
{
|
||||||
e.Graphics.DrawLine(Color.FromArgb(120, rectColor), new Point(2, 1), new Point(1, 2));
|
e.Graphics.DrawLine(Color.FromArgb(120, showTitleColor), new Point(2, 1), new Point(1, 2));
|
||||||
e.Graphics.DrawLine(Color.FromArgb(120, rectColor), new Point(2, Height - 1 - 1), new Point(1, Height - 1 - 2));
|
e.Graphics.DrawLine(Color.FromArgb(120, showTitleColor), new Point(2, Height - 1 - 1), new Point(1, Height - 1 - 2));
|
||||||
e.Graphics.DrawLine(Color.FromArgb(120, rectColor), new Point(Width - 1 - 2, 1), new Point(Width - 1 - 1, 2));
|
e.Graphics.DrawLine(Color.FromArgb(120, showTitleColor), new Point(Width - 1 - 2, 1), new Point(Width - 1 - 1, 2));
|
||||||
e.Graphics.DrawLine(Color.FromArgb(120, rectColor), new Point(Width - 1 - 2, Height - 1 - 1), new Point(Width - 1 - 1, Height - 1 - 2));
|
e.Graphics.DrawLine(Color.FromArgb(120, showTitleColor), new Point(Width - 1 - 2, Height - 1 - 1), new Point(Width - 1 - 1, Height - 1 - 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user