Hallo,
ich hätte gerne die Möglichkeit für den Bediener, dass er die heutige Zeit auswählen kann.
Was habe ich versucht?
Das Control verwendet. Leider kommt keine Uhrzeit.
Liegt bestimmt nur an den Properties.
Wer kann helfen?
Bild:

Grüße Oliver
private void dtpTest_ValueChanged(object sender, EventArgs e)
{
ctlAlarmClock1.AlarmTime = dtpTest.Value;
ctlAlarmClock1.AlarmSet = true;
lblTest.Text = "Alarm Time is " +
ctlAlarmClock1.AlarmTime.ToShortTimeString();
}
public partial class ctlAlarmClock : WFA_Ereignisse.ctlClock
{
private DateTime dteAlarmTime;
private bool blnAlarmSet;
private bool blnColorTicker;
// These properties will be declared as public to allow future
// developers to access them.
public DateTime AlarmTime
{
get
{
return dteAlarmTime;
}
set
{
dteAlarmTime = value;
}
}
public bool AlarmSet
{
get
{
return blnAlarmSet;
}
set
{
blnAlarmSet = value;
}
}
public ctlAlarmClock()
{
InitializeComponent();
}
protected override void timer1_Tick(object sender, System.EventArgs e)
{
// Calls the Timer1_Tick method of ctlClock.
base.timer1_Tick(sender, e);
// Checks to see if the Alarm is set.
if (AlarmSet == false)
return;
else
// If the date, hour and minute of the alarm time are the same as
// now, flash!
{
if (AlarmTime.Date == DateTime.Now.Date && AlarmTime.Hour ==
DateTime.Now.Hour && AlarmTime.Minute == DateTime.Now.Minute)
{
// Makes lblAlarmVisible, and changes the backcolor based on
// the value of blnColorTicker. The backcolor of the label
// will flash once per tick of the clock.
lblAlarm.Visible = true;
if (blnColorTicker == false)
{
lblAlarm.BackColor = Color.Red;
blnColorTicker = true;
}
else
{
lblAlarm.BackColor = Color.Blue;
blnColorTicker = false;
}
}
else
{
// Once the alarm has sounded for a minute, the label is made
// invisible again.
lblAlarm.Visible = false;
}
}
}
private void btnAlarmOff_Click(object sender, EventArgs e)
{
AlarmSet = false;
lblAlarm.Visible = false;
}
}