1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace Praktika5
- {
- public partial class Form3 : Form
- {
- ToolStripLabel dateLabel;
- ToolStripLabel timeLabel;
- ToolStripLabel infoLabel;
- Timer timer;
- public Form3()
- {
- InitializeComponent();
- infoLabel = new ToolStripLabel();
- infoLabel.Text = "Текущие дата и время:";
- dateLabel = new ToolStripLabel();
- timeLabel = new ToolStripLabel();
- statusStrip1.Items.Add(infoLabel);
- statusStrip1.Items.Add(dateLabel);
- statusStrip1.Items.Add(timeLabel);
- timer = new Timer() { Interval = 1000 };
- timer.Tick += timer_Tick;
- timer.Start();
- }
- void timer_Tick(object sender, EventArgs e)
- {
- dateLabel.Text = DateTime.Now.ToLongDateString();
- timeLabel.Text = DateTime.Now.ToLongTimeString();
- }
- }
- }
|