using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace 自定义控件
{
public class DigitalTextBox : TextBox
{
private DateTime _currentTextChangedTime; //记录最后一次Textchanged时间
private object _tmLocker = new object();
private Timer _tm;
public DigitalTextBox()
{
_currentTextChangedTime = DateTime.MinValue;
_tm = new Timer();
_tm.Interval = 100;
_tm.Enabled = false;
_tm.Tick += new EventHandler(tm_Tick);
}
private void tm_Tick(object sender, EventArgs e)
{
TimeSpan ts = DateTime.Now - _currentTextChangedTime;
if (ts.TotalMilliseconds <= 1000)
{
return;
}
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余2页未读,立即下载