Imports System.Globalization Imports DevComponents.DotNetBar Public Class tagvim Dim sal, mah, rooz As String Dim hafte, ii As Integer Public tar As New Date Dim fa As New PersianCalendar Dim bu(42) As ButtonX '---------------------------------- Private Sub tagvim_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load tar = Date.Now but() tarikh(tar) '-------------------------- End Sub '------------------ Public Sub tarikh(ByVal tare As Date) sal = fa.GetYear(tare) mah = fa.GetMonth(tare) rooz = fa.GetDayOfMonth(tare) mahnema() If fa.GetDayOfYear(tare) = fa.GetDayOfYear(Date.Now) And sal = fa.GetYear(Date.Now) Then p00.Visible = False Me.p0.BackColor = System.Drawing.Color.Transparent Else p00.Visible = True Me.p0.BackColor = System.Drawing.Color.Gainsboro End If bt_sal.Text = sal lb_sal.Text = sal lb_rooz.Text = rooz scha(tare) End Sub Public Sub mahnema() haftenema() Dim mah1 As String = "" Select Case mah Case "1" mah1 = "فروردین" Case "2" mah1 = "اردیبهشت" Case "3" mah1 = "خرداد" Case "4" mah1 = "تیر" Case "5" mah1 = "مرداد" Case "6" mah1 = "شهریور" Case "7" mah1 = "مهر" Case "8" mah1 = "آبان" Case "9" mah1 = "آذر" Case "10" mah1 = "دی" Case "11" mah1 = "بهمن" Case "12" mah1 = "اسفند" End Select bt_mah.Text = mah1 lb_mah.Text = mah1 mahsaz() End Sub Public Sub mahsaz() Dim conter As Integer For i As Integer = 1 To 42 bu(i).Visible = False Dim dd As New Date dd = fa.ToDateTime(sal, mah, 1, Date.Now.Hour, Date.Now.Minute, Date.Now.Second, Date.Now.Millisecond) hafte = fa.GetDayOfWeek(dd) Select Case hafte Case 0 ii = 2 Case 1 ii = 3 Case 2 ii = 4 Case 3 ii = 5 Case 4 ii = 6 Case 5 ii = 7 Case 6 ii = 1 End Select If i < fa.GetDaysInMonth(sal, mah) + ii And i >= ii Then conter += 1 bu(i).Text = conter bu(i).Visible = True bu(i).ColorTable = DevComponents.DotNetBar.eButtonColor.MagentaWithBackground If sal = fa.GetYear(Date.Now) And mah = fa.GetMonth(Date.Now) And bu(i).Text = fa.GetDayOfMonth(Date.Now) Then bu(i).ColorTable = DevComponents.DotNetBar.eButtonColor.BlueOrb End If End If Next End Sub Public Sub haftenema() Select Case fa.GetDayOfWeek(tar) Case 6 lb_hafte.Text = "شنبه" Case 0 lb_hafte.Text = "یکشنبه" Case 1 lb_hafte.Text = "دوشنبه" Case 2 lb_hafte.Text = "سه شنبه" Case 3 lb_hafte.Text = "چهار شنبه" Case 4 lb_hafte.Text = "پنج شنبه" Case 5 lb_hafte.Text = "جمعه" End Select End Sub Private Sub but() Dim cont As ButtonX For Each cont In p2.Controls AddHandler cont.Click, AddressOf click1 bu(cont.TabIndex) = cont Next End Sub Public Sub click1(ByVal sender As System.Object, ByVal e As System.EventArgs) Dim but As New ButtonX but = sender tarak1(sal, mah, CInt(but.Text)) tar = tarakdate tarikh(tar) ex1.Expanded = True End Sub Public Sub scha(ByVal tar1 As Date) Form1.schedulerControl.Start = tar1 Form1.vaght(tar1.DayOfWeek) End Sub Public Sub biron(ByVal tar1 As Date) tarikh(tar1) End Sub '----------------------- Private Sub bt_ba_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_ba.Click maah(1) End Sub Private Sub bt_gh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_gh.Click maah(-1) End Sub Public Sub maah(ByVal i As Integer) tar = fa.AddMonths(tar, i) tarikh(tar) End Sub Private Sub lb_ba_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lb_ba.Click roz(1) End Sub Private Sub lb_gh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lb_gh.Click roz(-1) End Sub Public Sub roz(ByVal i As Integer) tar = fa.AddDays(tar, i) tarikh(tar) End Sub Public Sub hafton(ByVal i As Integer) tar = fa.AddWeeks(tar, i) tarikh(tar) End Sub Private Sub p0_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles p0.Click, lb_hafte.Click, lb_mah.Click, lb_rooz.Click, lb_sal.Click ex1.Expanded = False End Sub Private Sub p00_MouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles p00.MouseHover Me.p00.Location = New System.Drawing.Point(2, 186) Me.p00.Name = "p00" Me.p00.Size = New System.Drawing.Size(48, 38) End Sub Private Sub p00_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles p00.MouseLeave Me.p00.Location = New System.Drawing.Point(2, 193) Me.p00.Size = New System.Drawing.Size(35, 31) End Sub Public Sub p00_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles p00.Click zarb() End Sub Public Sub zarb() tar = Date.Now tarikh(tar) End Sub '=============================================== '-------------------------------- '=============================================== Public tarakdate As Date Public tarak0(3) As Integer Public Sub tarak1(ByVal tsal As Integer, ByVal tmah As Integer, ByVal troz As Integer) tarakdate = fa.ToDateTime(tsal, tmah, troz, Date.Now.Hour, Date.Now.Minute, Date.Now.Second, Date.Now.Millisecond) End Sub Public Sub tarak2(ByVal tare As Date) tarak0(1) = fa.GetYear(tare) tarak0(2) = fa.GetMonth(tare) tarak0(3) = fa.GetDayOfMonth(tare) End Sub End Class