C#timer_tick 不执行问题
MainForm.cs
当我执行过addCustormForm.cs 中的timer11_Tick之后,在执行MainForm、cs的Card_Read,他本来应该执行MainForm.cs 下面的timer1_Tick,然而实际中却执行了addCustormForm.cs 中的timer11_Tick 这是为什么啊
private void buttonX18_Click(object sender, EventArgs e)
{
Card_Read();//二代证进入
}
public void Card_Read()
{
Int32 result;
Int32 port = 0;
UInt32 flag = 0;
try
{
result = Card.OpenCardReader(port, flag);
if (Convert.ToInt32(result) == 0)
{
timer1.Start();
}
else
{
General.meg("打开二代证读取器初始化失败!");
}
}
catch
{
General.meg("二代证读取器初始化失败!");
}
}
private void timer1_Tick(object sender, EventArgs e)
{
try
{
Int32 result;
string txt = "";
Card.PERSONINFOW info = new Card.PERSONINFOW();
//txt = Application.StartupPath + "\\imageNew.bmp";
result = Card.GetPersonMsgW(ref info, txt);
if (result == 0)
{
textBoxX4.Text = info.cardId;
buttonX3_Click(sender, e);
timer1.Stop();
Card.CloseCardReader();
}
}
catch
{
General.meg("二代证读取器故障!");
}
}当我执行过addCustormForm.cs 中的timer11_Tick之后,在执行MainForm、cs的Card_Read,他本来应该执行MainForm.cs 下面的timer1_Tick,然而实际中却执行了addCustormForm.cs 中的timer11_Tick 这是为什么啊
...全文
相关推荐
C#timer实现动态图片.rar_C#编程_C#__C#编程_C#_
在C#编程中,`Timer`控件是一个非常实用的工具,它允许程序在特定间隔内执行指定的任务,常用于创建动态效果或者周期性更新。
C#Timer.zip
- 大家可以一起讨论如何优化代码,比如计时器的精度调整、线程安全问题等,以提高代码质量和性能。
c#Timer控件的用法
例如: ```csharp private void timer1_Tick(object sender, EventArgs e) { // 在这里写入你的定时任务代码 } ``` 记得开启Timer
模拟时钟源代码C#timer事件
在编码过程中,需要注意以下几点:- 由于Timer是同步运行的,因此在Tick事件处理程序中应避免执行耗时的操作,以免阻塞UI更新。
Timer控件源码实例
+= new EventHandler(Timer_Tick); // 注册Tick事件 // 初始化Label this.currentTimeLabel.Text = "当前时间:"; this.currentTimeLabel.AutoSize


