From 59265b4bb12198e2179f4a221a07892d37799dbd Mon Sep 17 00:00:00 2001 From: Sunny Date: Sun, 26 Mar 2023 10:34:21 +0800 Subject: [PATCH] =?UTF-8?q?*=20UINumPadTextBox:=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E4=BA=8B=E4=BB=B6ValueChanged=EF=BC=8C?= =?UTF-8?q?=E4=B8=8B=E9=94=AE=E7=9B=98Enter=E4=BA=8B=E4=BB=B6=E7=9B=B8?= =?UTF-8?q?=E5=BA=94=E6=AD=A4=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SunnyUI/Controls/UINumPadTextBox.cs | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/SunnyUI/Controls/UINumPadTextBox.cs b/SunnyUI/Controls/UINumPadTextBox.cs index cb495912..434176be 100644 --- a/SunnyUI/Controls/UINumPadTextBox.cs +++ b/SunnyUI/Controls/UINumPadTextBox.cs @@ -1,4 +1,26 @@ -using System; +/****************************************************************************** + * SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。 + * CopyRight (C) 2012-2023 ShenYongHua(沈永华). + * QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com + * + * Blog: https://www.cnblogs.com/yhuse + * Gitee: https://gitee.com/yhuse/SunnyUI + * GitHub: https://github.com/yhuse/SunnyUI + * + * SunnyUI.dll can be used for free under the GPL-3.0 license. + * If you use this code, please keep this note. + * 如果您使用此代码,请保留此说明。 + ****************************************************************************** + * 文件名称: UINumPadTextBox.cs + * 文件说明: 模拟数字键盘输入框 + * 当前版本: V3.3 + * 创建日期: 2023-03-18 + * + * 2023-03-18: V3.3.3 增加文件说明 + * 2023-03-26: V3.3.3 增加默认事件ValueChanged,下键盘Enter事件相应此事件 +******************************************************************************/ + +using System; using System.ComponentModel; using System.Runtime.InteropServices; using System.Windows.Forms; @@ -6,6 +28,7 @@ using System.Windows.Forms; namespace Sunny.UI { [ToolboxItem(true)] + [DefaultEvent("ValueChanged")] public class UINumPadTextBox : UIDropControl, IToolTip { public UINumPadTextBox() @@ -16,6 +39,8 @@ namespace Sunny.UI fullControlSelect = true; } + public delegate void OnValueChanged(object sender, string value); + public event OnValueChanged ValueChanged; private NumPadType numPadType = NumPadType.Text; [DefaultValue(NumPadType.Text)] @@ -125,6 +150,7 @@ namespace Sunny.UI } break; case 13: + ValueChanged?.Invoke(this, Text); break; default: Win32.User.PostMessage(edit.Handle, WM_CHAR, (int)value, 0);