GrapeCity CalendarGrid for Windows Forms 2.0J
DateRange クラス
メンバ  使用例 

System.DateTime のコレクションを作成するための static メソッドおよびプロパティのセットを提供します。作成された System.DateTime コレクションから、インデクサーによって GcCalendarGridCalendarTable を取得できます。これは %[LangWord]static class% なので、継承またはインスタンス化できません。
構文
Public MustInherit NotInheritable Class DateRange 
public static class DateRange 
使用例
次のサンプルコードは、DateRange の使用方法を示します。
private void SetValue()
{
    // Use name to access the cell.
    this.gcCalendarGrid1.Template.Content[2, 0].Name = "cell1";

    // Set value to a cell in today.
    this.gcCalendarGrid1[DateTime.Today][1, 0].Value = "abc";
    this.gcCalendarGrid1[DateTime.Today]["cell1"].Value = "abc";

    // Set value to the cells in a date range.
    IEnumerable<DateTime> dateRange = DateRange.CreateDateRange(new DateTime(2014, 2, 1), new DateTime(2014, 2, 20));
    this.gcCalendarGrid1[dateRange][1, 0].Value = "abc";
    this.gcCalendarGrid1[dateRange]["cell1"].Value = "abc";

    // Set value to the cells in a yearly recurrence.
    IEnumerable<DateTime> yearlyDate = DateRange.CreateYearlyDayRecurrence(new DateTime(2000, 2, 1), 1, 100);
    this.gcCalendarGrid1[yearlyDate][1, 0].Value = "abc";
    this.gcCalendarGrid1[yearlyDate]["cell1"].Value = "abc";

    // Set value to the cells in a monthly weekday recurrence.
    IEnumerable<DateTime> monthlyWeekday = DateRange.CreateMonthlyWeekDayRecurrence(new DateTime(2014, 1, 1), DayOfWeekInMonth.Last, DayOfWeek.Friday, 1, new DateTime(2014, 12, 31));
    this.gcCalendarGrid1[monthlyWeekday][1, 0].Value = "abc";
    this.gcCalendarGrid1[monthlyWeekday]["cell1"].Value = "abc";

    // Set value to many cells. By the SetValue method, we can get better performance.
    for (int row = 0; row < this.gcCalendarGrid1.Template.RowCount; row++)
    {
        for (int column = 0; column < this.gcCalendarGrid1.Template.ColumnCount; column++)
        {
            this.gcCalendarGrid1.SetValue(DateTime.Today, row, column, "abc");
        }
    }

    // Clear the values and formats set to a date, to release the memory.
    this.gcCalendarGrid1.Clear(DateTime.Today);

    // Clear all the values and formats, to release the memory.
    this.gcCalendarGrid1.ClearAll();
}
Private Sub SetValue()
    ' Use name to access the cell.
    Me.gcCalendarGrid1.Template.Content(2, 0).Name = "cell1"

    ' Set value to a cell in today.
    Me.gcCalendarGrid1(DateTime.Today)(1, 0).Value = "abc"
    Me.gcCalendarGrid1(DateTime.Today)("cell1").Value = "abc"

    ' Set value to the cells in a date range.
    Dim dateRange__1 As IEnumerable(Of DateTime) = DateRange.CreateDateRange(New DateTime(2014, 2, 1), New DateTime(2014, 2, 20))
    Me.gcCalendarGrid1(dateRange__1)(1, 0).Value = "abc"
    Me.gcCalendarGrid1(dateRange__1)("cell1").Value = "abc"

    ' Set value to the cells in a yearly recurrence.
    Dim yearlyDate As IEnumerable(Of DateTime) = DateRange.CreateYearlyDayRecurrence(New DateTime(2000, 2, 1), 1, 100)
    Me.gcCalendarGrid1(yearlyDate)(1, 0).Value = "abc"
    Me.gcCalendarGrid1(yearlyDate)("cell1").Value = "abc"

    ' Set value to the cells in a monthly weekday recurrence.
    Dim monthlyWeekday As IEnumerable(Of DateTime) = DateRange.CreateMonthlyWeekDayRecurrence(New DateTime(2014, 1, 1), DayOfWeekInMonth.Last, DayOfWeek.Friday, 1, New DateTime(2014, 12, 31))
    Me.gcCalendarGrid1(monthlyWeekday)(1, 0).Value = "abc"
    Me.gcCalendarGrid1(monthlyWeekday)("cell1").Value = "abc"

    ' Set value to many cells. By the SetValue method, we can get better performance.
    For row As Integer = 0 To Me.gcCalendarGrid1.Template.RowCount - 1
        For column As Integer = 0 To Me.gcCalendarGrid1.Template.ColumnCount - 1
            Me.gcCalendarGrid1.SetValue(DateTime.Today, row, column, "abc")
        Next
    Next

    ' Clear the values and formats set to a date, to release the memory.
    Me.gcCalendarGrid1.Clear(DateTime.Today)

    ' Clear all the values and formats, to release the memory.
    Me.gcCalendarGrid1.ClearAll()
End Sub
継承階層

System.Object
   GrapeCity.Win.CalendarGrid.DateRange

参照

DateRange メンバ
GrapeCity.Win.CalendarGrid 名前空間

 

 


c 2008 GrapeCity inc. All rights reserved.