Yazı Font Küçült Yazı Font Büyült

Digital Saat Örneği

Bu uygulamamızda Digital Saat ve Tarih göreceğiz.
İlk önce yapılması gereken digital rakamları oluşturmak. Ben bu örnekte,
bin/Debug içinde digit klasörü oluşturdum ve rakamlara dicit00... gibi
adlandırdım.

Resim1

Şekil 1

Yine Şekil 2 de görüldüğü gibi Sadece Digital Saati Göster linkine  tıklayarak, saatin görülmesini sağlayabilirsiniz. Ayrıca Digital Saati Gizle linkine tıklayarak System Tray‘de ikon şeklinde gösterebilirsiniz. Bu ikona sağ tıklayıp, Programı Göster linkinden tekrardan Saatimizi aktif görebiliriz.

Resim2

Şekil 2

Son olarak uygulamamız türkçe tarihe göre gg/aa/yyyy şeklinde yapıldı.
(Ör: =06/04/2007)
Alternatif Kısmında; eğer tarih kısmı a/g/yyyy şeklinde olan (Ör: 4/6/2007) sitemlerde ufak bir kod ile bu sorunu çözüyoruz. Bahadirsa
Forma Yazılacak Kodlar: (gg/aa/yyyy için)

Public Class Form1
Dim str As String
Dim str2(15) As String
Dim i As Integer = 0
Dim tarih As Date = Date.Now.Date
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
btnYenile.Text = "Tarih ve Gün Yenile" & vbCrLf & "(Date and Day Refresh)"
btnSaat.Text = "Durdur" & vbCrLf & "(Stop)"
Timer1.Enabled = True
Timer1.Interval = 1000
‘saat
str = Format(Now, "Long Time")
str2(0) = str.Substring(0, 1)
str2(1) = str.Substring(1, 1)
str2(2) = str.Substring(2, 1)
str2(3) = str.Substring(3, 1)
str2(4) = str.Substring(4, 1)
str2(5) = str.Substring(5, 1)
str2(6) = str.Substring(6, 1)
str2(7) = str.Substring(7, 1)

If str(2) = "" Then
pb3.Image = Image.FromFile("digit\yok.bmp")
pb6.Image = Image.FromFile("digit\yok.bmp")
Else
pb3.Image = Image.FromFile("digit\ikinokta.bmp")
pb6.Image = Image.FromFile("digit\ikinokta.bmp")
End If

pb1.Image = Image.FromFile("digit\dicit0" & str2(0) & ".bmp")
pb2.Image = Image.FromFile("digit\dicit0" & str2(1) & ".bmp")
‘pb3.Image = Image.FromFile("digit\ikinokta.bmp")
pb4.Image = Image.FromFile("digit\dicit0" & str2(3) & ".bmp")
pb5.Image = Image.FromFile("digit\dicit0" & str2(4) & ".bmp")
‘pb6.Image = Image.FromFile("digit\ikinokta.bmp")
pb7.Image = Image.FromFile("digit\dicit0" & str2(6) & ".bmp")
pb8.Image = Image.FromFile("digit\dicit0" & str2(7) & ".bmp")

‘Tarih
str2(8) = tarih.ToString.Substring(0, 1)
str2(9) = tarih.ToString.Substring(1, 1)
str2(10) = tarih.ToString.Substring(3, 1)
str2(11) = tarih.ToString.Substring(4, 1)
str2(12) = tarih.ToString.Substring(6, 1)
str2(13) = tarih.ToString.Substring(7, 1)
str2(14) = tarih.ToString.Substring(8, 1)
str2(15) = tarih.ToString.Substring(9, 1)

pb9.Image = Image.FromFile("digit\dicit0" & str2(8) & ".bmp")
pb10.Image = Image.FromFile("digit\dicit0" & str2(9) & ".bmp")
pb11.Image = Image.FromFile("digit\teknokta.bmp")
pb12.Image = Image.FromFile("digit\dicit0" & str2(10) & ".bmp")
pb13.Image = Image.FromFile("digit\dicit0" & str2(11) & ".bmp")
pb14.Image = Image.FromFile("digit\teknokta.bmp")
pb15.Image = Image.FromFile("digit\dicit0" & str2(12) & ".bmp")
pb16.Image = Image.FromFile("digit\dicit0" & str2(13) & ".bmp")
pb17.Image = Image.FromFile("digit\dicit0" & str2(14) & ".bmp")
pb18.Image = Image.FromFile("digit\dicit0" & str2(15) & ".bmp")

‘gun
Label3.Text = tarih.Date.DayOfWeek.ToString
If Label3.Text = DayOfWeek.Sunday.ToString Then
Label3.Text = DayOfWeek.Sunday.ToString & "-" & "Pazar"
ElseIf Label3.Text = DayOfWeek.Monday.ToString Then
Label3.Text = DayOfWeek.Monday.ToString & "-" & "Pazartesi"
ElseIf Label3.Text = DayOfWeek.Tuesday.ToString Then
Label3.Text = DayOfWeek.Tuesday.ToString & "-" & "Salı"
ElseIf Label3.Text = DayOfWeek.Wednesday.ToString Then
Label3.Text = DayOfWeek.Wednesday.ToString & "-" & "Çarşamba"
ElseIf Label3.Text = DayOfWeek.Thursday.ToString Then
Label3.Text = DayOfWeek.Thursday.ToString & "-" & "Perşembe"
ElseIf Label3.Text = DayOfWeek.Friday.ToString Then
Label3.Text = DayOfWeek.Friday.ToString & "-" & "Cuma"
ElseIf Label3.Text = DayOfWeek.Saturday.ToString Then
Label3.Text = DayOfWeek.Saturday.ToString & "-" & "Cumartesi"
End If

With Me
.Text = "Digital Hours of Application & Dig. Saat Uygulaması.Programmer by Bahadirsa"
.ControlBox = False
.Location = New Point(350, 0)
.MaximizeBox = False
End With

LinkLabel1.Text = "Uygulamadan Çık (Exit of Application)"
LinkLabel2.Text = "Digital Saati Gizle (Hide)"
LinkLabel3.Text = "Sadece Digital Saati Göster ( To Show of Only Digital Hour ) "
NotifyIcon1.ContextMenuStrip = ContextMenuStrip1
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

i = i + 1
str = Format(Now, "Long Time")

str2(0) = str.Substring(0, 1)
str2(1) = str.Substring(1, 1)
str2(2) = str.Substring(2, 1)
str2(3) = str.Substring(3, 1)
str2(4) = str.Substring(4, 1)
str2(5) = str.Substring(5, 1)
str2(6) = str.Substring(6, 1)
str2(7) = str.Substring(7, 1)


pb1.Image = Image.FromFile("digit\dicit0" & str2(0) & ".bmp")
pb2.Image = Image.FromFile("digit\dicit0" & str2(1) & ".bmp")
‘pb3.Image = Image.FromFile("digit\dicit0" & str2(2) & ".bmp")
pb4.Image = Image.FromFile("digit\dicit0" & str2(3) & ".bmp")
pb5.Image = Image.FromFile("digit\dicit0" & str2(4) & ".bmp")
‘pb6.Image = Image.FromFile("digit\dicit0" & str2(4) & ".bmp")
pb7.Image = Image.FromFile("digit\dicit0" & str2(6) & ".bmp")
pb8.Image = Image.FromFile("digit\dicit0" & str2(7) & ".bmp")

If i = 1 Then
pb3.Image = Image.FromFile("digit\yok.bmp")
pb6.Image = Image.FromFile("digit\yok.bmp")
ElseIf i = 2 Then
pb3.Image = Image.FromFile("digit\ikinokta.bmp")
pb6.Image = Image.FromFile("digit\ikinokta.bmp")
ElseIf i > 2 Then
i = 0
End If

‘gün, tarih yenile
‘Tarih
tarih = Date.Now.Date
str2(8) = tarih.ToString.Substring(0, 1)
str2(9) = tarih.ToString.Substring(1, 1)
str2(10) = tarih.ToString.Substring(3, 1)
str2(11) = tarih.ToString.Substring(4, 1)
str2(12) = tarih.ToString.Substring(6, 1)
str2(13) = tarih.ToString.Substring(7, 1)
str2(14) = tarih.ToString.Substring(8, 1)
str2(15) = tarih.ToString.Substring(9, 1)

pb9.Image = Image.FromFile("digit\dicit0" & str2(8) & ".bmp")
pb10.Image = Image.FromFile("digit\dicit0" & str2(9) & ".bmp")
pb11.Image = Image.FromFile("digit\teknokta.bmp")
pb12.Image = Image.FromFile("digit\dicit0" & str2(10) & ".bmp")
pb13.Image = Image.FromFile("digit\dicit0" & str2(11) & ".bmp")
pb14.Image = Image.FromFile("digit\teknokta.bmp")
pb15.Image = Image.FromFile("digit\dicit0" & str2(12) & ".bmp")
pb16.Image = Image.FromFile("digit\dicit0" & str2(13) & ".bmp")
pb17.Image = Image.FromFile("digit\dicit0" & str2(14) & ".bmp")
pb18.Image = Image.FromFile("digit\dicit0" & str2(15) & ".bmp")

‘gun
Label3.Text = tarih.Date.DayOfWeek.ToString
If Label3.Text = DayOfWeek.Sunday.ToString Then
Label3.Text = DayOfWeek.Sunday.ToString & "-" & "Pazar"
ElseIf Label3.Text = DayOfWeek.Monday.ToString Then
Label3.Text = DayOfWeek.Monday.ToString & "-" & "Pazartesi"
ElseIf Label3.Text = DayOfWeek.Tuesday.ToString Then
Label3.Text = DayOfWeek.Tuesday.ToString & "-" & "Salı"
ElseIf Label3.Text = DayOfWeek.Wednesday.ToString Then
Label3.Text = DayOfWeek.Wednesday.ToString & "-" & "Çarşamba"
ElseIf Label3.Text = DayOfWeek.Thursday.ToString Then
Label3.Text = DayOfWeek.Thursday.ToString & "-" & "Perşembe"
ElseIf Label3.Text = DayOfWeek.Friday.ToString Then
Label3.Text = DayOfWeek.Friday.ToString & "-" & "Cuma"
ElseIf Label3.Text = DayOfWeek.Saturday.ToString Then
Label3.Text = DayOfWeek.Saturday.ToString & "-" & "Cumartesi"
End If


End Sub

Private Sub btnSaat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSaat.Click
If btnSaat.Text = "Durdur" & vbCrLf & "(Stop)" Then
btnSaat.Text = "Başlat" & vbCrLf & "(Begin)"
Timer1.Enabled = False
Else
btnSaat.Text = "Durdur" & vbCrLf & "(Stop)"
Timer1.Enabled = True
End If
End Sub

Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
Me.Close()
End Sub

Private Sub LinkLabel1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkLabel1.MouseLeave
LinkLabel1.LinkColor = Color.Blue
End Sub

Private Sub LinkLabel1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles LinkLabel1.MouseMove
LinkLabel1.LinkColor = Color.Red
End Sub

Private Sub LinkLabel2_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel2.LinkClicked
pgizle_Click(sender, e)
End Sub

Private Sub LinkLabel2_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkLabel2.MouseLeave
LinkLabel2.LinkColor = Color.Blue
End Sub

Private Sub LinkLabel2_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles LinkLabel2.MouseMove
LinkLabel2.LinkColor = Color.Red
End Sub

Private Sub pgizle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pgizle.Click
Me.Hide()
End Sub

Private Sub pexit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pexit.Click
Me.Close()
End Sub

Private Sub pgoster_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pgoster.Click
Me.Show()
End Sub

Private Sub btnYenile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnYenile.Click
Timer1_Tick(sender, e)
End Sub

Private Sub LinkLabel3_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel3.LinkClicked
If LinkLabel3.Text = "Sadece Digital Saati Göster ( To Show of Only Digital Hour ) " Then
LinkLabel3.Text = "Tüm Uygulamayı Göster ( To Show of All Application ) "
Me.Size = New System.Drawing.Size(496, 130)
Label2.Visible = False
Else
LinkLabel3.Text = "Sadece Digital Saati Göster ( To Show of Only Digital Hour ) "
Me.Size = New System.Drawing.Size(496, 264)
Label2.Visible = True
End If
End Sub

Private Sub LinkLabel3_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkLabel3.MouseLeave
LinkLabel3.LinkColor = Color.Blue
End Sub

Private Sub LinkLabel3_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles LinkLabel3.MouseMove
LinkLabel3.LinkColor = Color.Red
End Sub
End Class