7 Kasım 2012 Çarşamba

C# Alarm Programı

Programın Görüntüsü


Programın Özellikleri
Programda 3 tane TextBox, 2 Buton ve 2 Timer Kullanılmıştır.
Program açıldığında, açıldığı andaki tarih ve saat ekrna gelir.
TextBox3 boş kalır burayada alarm saati geldiğinde ekrana çıkacak mesaj yazılır.
Alar süresi ve tarihi girilip alarmı aç butonuna basıldığında alarm çalışmaya başlar ve bilgisayarınızın saatiyle aynı olunca size uyarı mesajınızı verir ve Textbox3 yanıp sönmeye başlar.
Alarmı Kapat dediğinizde yanıp sönme olayı durur.
Programın Kodları
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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
timer1.Enabled = true;
this.Text = "Alarm Açık";
}
private void Form1_Load(object sender, EventArgs e)
{
textBox1.Text = DateTime.Now.ToShortDateString();
textBox2.Text = DateTime.Now.ToLongTimeString();
timer2.Enabled = false;
timer1.Enabled = false;
timer2.Interval = 100;
timer1.Interval = 1000;
Text = "Alarm Kapalı";
}
private void timer1_Tick(object sender, EventArgs e)
{
if (textBox1.Text == DateTime.Now.ToShortDateString() && textBox2.Text == DateTime.Now.ToLongTimeString())
{
timer2.Enabled = true;
MessageBox.Show(textBox3.Text, "Alarm", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void timer2_Tick(object sender, EventArgs e)
{
Color c;
c = textBox3.BackColor;
textBox3.BackColor = textBox3.ForeColor;
textBox3.ForeColor = c;
}
private void button2_Click(object sender, EventArgs e)
{
timer2.Enabled = false;
timer1.Enabled = false;
this.Text = "Alarm Kapalı";
}
}
}
İndirme Linki

Hiç yorum yok:

Yorum Gönder