Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Windows.Forms;
- namespace WindowsFormsApp1
- {
- public partial class Form1 : Form
- {
- List<Label> labels = new List<Label>();
- public Form1()
- {
- try
- {
- //InitializeComponent();
- Width = 500;
- var flp = new FlowLayoutPanel { Parent = this, Dock = DockStyle.Fill };
- for (int i = 0; i < 32; i++)
- {
- var label = new Label { Parent = flp, Width = 150, BorderStyle = BorderStyle.FixedSingle };
- labels.Add(label);
- }
- var timer = new Timer();
- timer.Interval = 1000;
- timer.Tick += Timer_Tick;
- timer.Start();
- }
- catch (Exception ex) { MessageBox.Show(ex.Message); Environment.Exit(1); }
- }
- private void Timer_Tick(object sender, EventArgs e)
- {
- foreach (var label in labels)
- {
- label.Text = DateTime.UtcNow.ToString("o");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement