none
vs2008 listbox作萬年曆之潤年計算 RRS feed

  • 問題

  • 先在此感謝各位前輩協助用listbox來使用萬年曆之不可能任務大致完成..再此在次感謝~尤其是柔爛前輩
    最後的問題想再請各位前輩教導..目前的潤年的2月有28及29天..不知該如何下手.因我有找到算試但看不太懂..目前的日期設定程式如下,請前位前輩協助~Dim struArrayM1(monthDays(0) - 1) As DayInfo
            Dim oneDay As DayInfo
            ComboBox1.Text = "098"
            Dim initialDate As Date = New Date(1911 + Integer.Parse(ComboBox1.Text), 1, 1)

            Dim dateInterval As DateInterval
            dateInterval = Microsoft.VisualBasic.DateInterval.DayOfYear
            Dim i As Integer
            For i = 0 To (monthDays(0) - 1)
                oneDay = New DayInfo
                oneDay.today = DateAdd(dateInterval, i, initialDate)
                oneDay.dayOfWeek = oneDay.today.DayOfWeek
                oneDay.dayOfMonth = oneDay.today.Day
                struArrayM1(i) = oneDay
            Next

            Dim col As Integer = 0
            Dim row As Integer = 0
            i = 0
            For col = 0 To 6
                For row = 0 To 5
                    'If (row + col * 7) > 34 Then '30 暫改成 35
                    If (col + row * 7 - struArrayM1(0).dayOfWeek) > (monthDays(0) - 1) Then
                        i = i + 1
                        '暫時 mark row = row + 1
                        Continue For
                    End If

                    If (col + row * 7 - struArrayM1(0).dayOfWeek) >= 0 Then
                        MonthCalendar1.Items(i) = struArrayM1(col + row * 7 - struArrayM1(0).dayOfWeek).dayOfMonth.ToString()
                    End If
                    i = i + 1
                Next
            Next

    2009年9月3日 上午 02:59

解答

所有回覆