PowerTools CalendarGrid for Windows Forms 1.0J
Name プロパティ (CalendarCell)
使用例 

セルの名前を取得または設定します。
構文
Public Property Name As String
public string Name {get; set;}

プロパティ値

セル名を示す System.String 値。大文字と小文字は区別されません。既定値は System.String.Empty です。
例外
例外解説
System.InvalidOperationExceptionセルが CalendarTemplate に属していません。
System.ArgumentException名前が CalendarTable 内の他のセルと重複しています。
解説
名前は CalendarTemplate 内のセルにのみ設定できます。CalendarTemplateGcCalendarGrid に関連付けれらた後、セル名を使用して GcCalendarGrid 内のセルにアクセスできます。セル名は CalendarTable 内で重複できません。
使用例
次のサンプルコードは、セル名によって CalendarCell にアクセスする方法を示します。
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
参照

CalendarCell クラス
CalendarCell メンバ

 

 


© 2014 GrapeCity inc. All rights reserved.