public TimerControl() { InitializeComponent(); sounds = new SoundPlayer[4]; timerAlerts = new List <int>(); // prevent flickering ControlExtensions.DoubleBuffered(listViewTimer, true); // add ButtonAddTimers var times = new Dictionary <string, TimeSpan>() { { "+1 m", new TimeSpan(0, 1, 0) }, { "+5 m", new TimeSpan(0, 5, 0) }, { "+20 m", new TimeSpan(0, 20, 0) }, { "+1 h", new TimeSpan(1, 0, 0) }, { "+5 h", new TimeSpan(5, 0, 0) }, { "+1 d", new TimeSpan(24, 0, 0) } }; int i = 0; foreach (KeyValuePair <string, TimeSpan> ts in times) { var bta = new uiControls.ButtonAddTime(); bta.timeSpan = ts.Value; bta.Text = "Hi"; bta.Text = ts.Key; bta.addTimer += buttonAddTime_addTimer; bta.Size = new Size(54, 23); bta.Location = new Point(6 + (i % 3) * 60, 48 + (i / 3) * 29); groupBox1.Controls.Add(bta); i++; } }
public TimerControl() { this.Load += TimerControl_Load; InitializeComponent(); sounds = new SoundPlayer[4]; timerAlerts = new List <int>(); // prevent flickering listViewTimer.DoubleBuffered(true); // add ButtonAddTimers var times = new Dictionary <string, TimeSpan>() { { "+1 m", new TimeSpan(0, 1, 0) }, { "+5 m", new TimeSpan(0, 5, 0) }, { "+20 m", new TimeSpan(0, 20, 0) }, { "+1 h", new TimeSpan(1, 0, 0) }, { "+5 h", new TimeSpan(5, 0, 0) }, { "+1 d", new TimeSpan(24, 0, 0) } }; int i = 0; foreach (KeyValuePair <string, TimeSpan> ts in times) { var bta = new uiControls.ButtonAddTime { timeSpan = ts.Value, Text = ts.Key, Size = new Size(54, 23), Location = new Point(6 + i % 3 * 60, 48 + i / 3 * 29) }; bta.addTimer += buttonAddTime_addTimer; groupBox1.Controls.Add(bta); i++; } }