Kaydol:
Kayıt Yorumları
(
Atom
)
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace C_Sharp_Form_Alarm_Programı_Yapma { public partial class FormAlarm : Form { public FormAlarm() { InitializeComponent(); } private void Form1_Load(object sender, System.EventArgs e) { //tarih ve saati Text kutularında göster dateTimePickerTime.Value = DateTime.Now; //Başlangıçta alarm kapalı timer.Enabled = false; timerUyari.Enabled = false; //her 1000 ms'de bir alarmı kontrol etsin timer.Interval = 1000; timerUyari.Interval = 300; Text = "Alarm Kapalı"; } private void timer_Tick(object sender, EventArgs e) { //alarm zamanı geldiyse alam mesajı ver yanıp sönerek uyarı ver if (dateTimePickerTime.Value >= DateTime.Now) { timer.Enabled = false; // Alarm metnini bildir MessageBox.Show(txtMesaj.Text,"Uyarı",MessageBoxButtons.OK,MessageBoxIcon.Warning); timerUyari.Enabled = true; } } private void timerUyari_Tick(object sender, EventArgs e) { //uyarı aktif olduğunda yanıp sönme özelliğini oluşturmak //için arka plan rengini devamlı değiştir Color color = txtMesaj.ForeColor; txtMesaj.ForeColor = txtMesaj.BackColor; txtMesaj.BackColor = color; } private void btnAlarmAc_Click(object sender, EventArgs e) { //Alarmı aktif yap timer.Enabled = true; this.Text = "Alarm Açık"; } private void btnAlarmKapa_Click(object sender, EventArgs e) { //Alarmı kapat timerUyari.Enabled = false; this.Text = "Alarm Kapalı"; //varsayılan ayarlara göra alarm görüntüsünü ayarla dateTimePickerTime.Value = DateTime.Now; txtMesaj.BackColor = Color.White; txtMesaj.ForeColor = Color.Black; } } }
Hiç yorum yok :
Yorum Gönder