PowerTools CalendarGrid for Windows Forms 1.0J
セルのスタイルを設定する(テンプレート)

テンプレートでは、セルごとに背景色、前景色、罫線などのスタイルを設定できます。


背景色の設定

背景色を設定するには、CalendarCellStyle.BackColorプロパティを使用します。

Dim template As New GrapeCity.Win.CalendarGrid.CalendarTemplate()
' コンテンツセクションの1行1列目のセルの背景色を設定します。
template.Content.Rows(0).Cells(0).CellStyle.BackColor = Color.Green

GcCalendarGrid1.Template = template
GrapeCity.Win.CalendarGrid.CalendarTemplate template = new GrapeCity.Win.CalendarGrid.CalendarTemplate();
// コンテンツセクションの1行1列目のセルの背景色を設定します。
template.Content.Rows[0].Cells[0].CellStyle.BackColor = Color.Green;

gcCalendarGrid1.Template = template;


前景色の設定

前景色を設定するには、CalendarCellStyle.ForeColorプロパティを使用します。

Dim template As New GrapeCity.Win.CalendarGrid.CalendarTemplate()
' コンテンツセクションの1行1列目のセルの前景色を設定します。
template.Content.Rows(0).Cells(0).CellStyle.ForeColor = Color.Red
template.Content.Rows(0).Cells(0).Value = "AAA"

GcCalendarGrid1.Template = template
GrapeCity.Win.CalendarGrid.CalendarTemplate template = new GrapeCity.Win.CalendarGrid.CalendarTemplate();
// コンテンツセクションの1行1列目のセルに背景色を設定します。
template.Content.Rows[0].Cells[0].CellStyle.ForeColor = Color.Red;
template.Content.Rows[0].Cells[0].Value = "AAA";

gcCalendarGrid1.Template = template;


罫線の設定

罫線を設定するには、次のプロパティを使用します。

CalendarCellStyle.BottomBorderプロパティ : 下罫線を設定します。
CalendarCellStyle.LeftBorderプロパティ : 左罫線を設定します。
CalendarCellStyle.RightBorderプロパティ : 右罫線を設定します。
CalendarCellStyle.TopBorderプロパティ : 上罫線を設定します。

Dim template As New GrapeCity.Win.CalendarGrid.CalendarTemplate()
' コンテンツセクションの1行1列目のセルに下罫線を設定します。
template.Content.Rows(0).Cells(0).CellStyle.BottomBorder = _
    New GrapeCity.Win.CalendarGrid.CalendarBorderLine(Color.Silver, GrapeCity.Win.CalendarGrid.BorderLineStyle.Double)

GcCalendarGrid1.Template = template
GrapeCity.Win.CalendarGrid.CalendarTemplate template = new GrapeCity.Win.CalendarGrid.CalendarTemplate();
// コンテンツセクションの1行1列目のセルに下罫線を設定します。
template.Content.Rows[0].Cells[0].CellStyle.BottomBorder =
    new GrapeCity.Win.CalendarGrid.CalendarBorderLine(Color.Silver, GrapeCity.Win.CalendarGrid.BorderLineStyle.Double);

gcCalendarGrid1.Template = template;


フォントの設定

フォントを設定するには、CalendarCellStyle.Fontプロパティを使用します。

Dim template As New GrapeCity.Win.CalendarGrid.CalendarTemplate()
' コンテンツセクションの1行1列目のセルにフォントを設定します。
template.Content.Rows(0).Cells(0).CellStyle.Font = New Font("MS UI Gothic", 12, FontStyle.Bold)
template.Content.Rows(0).Cells(0).Value = "フォント設定"

GcCalendarGrid1.Template = template
GrapeCity.Win.CalendarGrid.CalendarTemplate template = new GrapeCity.Win.CalendarGrid.CalendarTemplate();
// コンテンツセクションの1行1列目のセルにフォントを設定します。
template.Content.Rows[0].Cells[0].CellStyle.Font = new Font("MS UI Gothic", 12, FontStyle.Bold);
template.Content.Rows[0].Cells[0].Value = "フォント設定";

gcCalendarGrid1.Template = template;
参照

 

 


© 2014 GrapeCity inc. All rights reserved.