我写的类如下:
public class Class1
{
public System.Windows.Forms.Timer ab = new System.Windows.Forms.Timer(); public void Init()
{
ab.Interval = 1000;
ab.Enabled = true;
ab.Tick += new EventHandler(cuiyh);
}
public void cuiyh(object sender, EventArgs e)
{ Console.WriteLine("cuiyh");
}
}
我写的控制台程序如下:
using System;
using System.Collections.Generic;
using System.Text;
using YHuaSoft;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
YHuaSoft.Class1 ac = new Class1();
ac.Init();
Console.ReadLine();
}
}
}
为什么在控制台程序中,不连续输出“cuiyh”,谢谢,在线等!!!
public class Class1
{
public System.Windows.Forms.Timer ab = new System.Windows.Forms.Timer(); public void Init()
{
ab.Interval = 1000;
ab.Enabled = true;
ab.Tick += new EventHandler(cuiyh);
}
public void cuiyh(object sender, EventArgs e)
{ Console.WriteLine("cuiyh");
}
}
我写的控制台程序如下:
using System;
using System.Collections.Generic;
using System.Text;
using YHuaSoft;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
YHuaSoft.Class1 ac = new Class1();
ac.Init();
Console.ReadLine();
}
}
}
为什么在控制台程序中,不连续输出“cuiyh”,谢谢,在线等!!!
解决方案 »
- c#窗口最大化时控件也变大
- Winform 程序中如何在Treeview的节点后面添加按钮实现添加和删除的功能
- C# list 树 操作方法
- C# winform 资源文件如何编译后成为独立文件
- 又一个很难的题_违反并发性: UpdateCommand影响了预期 1 条记录中的 0 条
- web Form 窗口中如何弹出一个对话框?
- .NET,想说爱你不容易...问题太多了
- 我也不知道问题该发表在哪?如何让光盘仅能在一台电脑上运行!请专家解决!
- 继续送分,先来先得,前5名1-3个三角的有效!
- 100分请高手解答:如何将vc#做好的应用程序做成安装程序?
- 跪求答案:C#能调用微软流媒体DRM加密SDK吗?
- 关于那些点击类网赚的小程序如何实现?
ab.Enabled = true;
ab.Tick += new EventHandler(cuiyh);=>应该先绑定事件,再打开定时器。 ab.Tick += new EventHandler(cuiyh);
ab.Interval = 1000;
ab.Enabled = true;
借点人气 找人帮帮忙