* UITextBox: 增加GotFocus和LostFocus事件

This commit is contained in:
Sunny 2021-08-01 20:33:05 +08:00
parent 4a108f1db5
commit 0435024bbc
6 changed files with 14 additions and 1 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -63,6 +63,8 @@ namespace Sunny.UI
edit.Leave += Edit_Leave; edit.Leave += Edit_Leave;
edit.Validated += Edit_Validated; edit.Validated += Edit_Validated;
edit.Validating += Edit_Validating; edit.Validating += Edit_Validating;
edit.GotFocus += Edit_GotFocus;
edit.LostFocus += Edit_LostFocus;
edit.Invalidate(); edit.Invalidate();
Controls.Add(edit); Controls.Add(edit);
@ -84,12 +86,23 @@ namespace Sunny.UI
TextAlignmentChange += UITextBox_TextAlignmentChange; TextAlignmentChange += UITextBox_TextAlignmentChange;
} }
private void Edit_LostFocus(object sender, EventArgs e)
{
LostFocus?.Invoke(this, e);
}
private void Edit_GotFocus(object sender, EventArgs e)
{
GotFocus?.Invoke(this, e);
}
private void Edit_Validating(object sender, CancelEventArgs e) private void Edit_Validating(object sender, CancelEventArgs e)
{ {
Validating?.Invoke(this, e); Validating?.Invoke(this, e);
} }
public new EventHandler GotFocus;
public new EventHandler LostFocus;
public new CancelEventHandler Validating; public new CancelEventHandler Validating;
public new event EventHandler Validated; public new event EventHandler Validated;