Вот код:
| Код | class Program:Form { Timer timer1 = new Timer();
static void Main(string[] args) { Application.Run(new Program()); }
public Program() { Text = ""; BackColor = Color.Brown; ForeColor = SystemColors.WindowText;
timer1.Enabled = true; timer1.Interval = 5000; } protected override void OnPaint(PaintEventArgs pea) { Graphics grfx = pea.Graphics; grfx.SmoothingMode = SmoothingMode.HighQuality; this.Activate(); timer1.Tick+=new EventHandler(timer1_Tick); } public void timer1_Tick(object obj, EventArgs e) { Console.WriteLine("OK!OK!"); } }
|
Вопрос: а почему сообщение выводится 2 раза??? |