作成日: 2022/03/14 最終更新日: 2022/03/30
文書種別
使用方法
詳細
アポイントメント型セル(AppointmentCell)のRenderer.FillColorプロパティでバーの色を設定できますが、テンプレートに配置したアポイントメント型セルのFillColorプロパティを設定すると同一行のアポイントメント型セルのバーは同じ色になります。
同一行のアポイントメント型セルに異なるバーの色を設定するには、実行時に複数のアポイントメント型セルを生成し、それぞれをセルに設定します。
[Visual Basic]
Imports GrapeCity.Win.CalendarGrid
Dim today As DateTime = DateTime.Today
' Appointment型セルの設定
Dim appointmentCellType1 As New CalendarAppointmentCellType()
appointmentCellType1.Renderer.FillColor = Color.Yellow
Dim appointmentCellType2 As New CalendarAppointmentCellType()
appointmentCellType2.Renderer.FillColor = Color.LightGreen
' CalendarGridにAppointment型セルを配置
GcCalendarGrid1.Content(today).Rows(1).Cells(0).CellType = appointmentCellType1.Clone()
GcCalendarGrid1.Content(today).Rows(1).Cells(0).Value = "項目1"
GcCalendarGrid1.Content(today).Rows(1).Cells(0).ColumnSpan = 3
GcCalendarGrid1.Content(today.AddDays(4)).Rows(1).Cells(0).CellType = appointmentCellType2.Clone()
GcCalendarGrid1.Content(today.AddDays(4)).Rows(1).Cells(0).Value = "項目2"
GcCalendarGrid1.Content(today.AddDays(4)).Rows(1).Cells(0).ColumnSpan = 3
[C#]
using GrapeCity.Win.CalendarGrid;
var today = DateTime.Today;
// Appointment型セルの設定
CalendarAppointmentCellType appointmentCellType1 = new CalendarAppointmentCellType();
appointmentCellType1.Renderer.FillColor = Color.Yellow;
CalendarAppointmentCellType appointmentCellType2 = new CalendarAppointmentCellType();
appointmentCellType2.Renderer.FillColor = Color.LightGreen;
// CalendarGridにAppointment型セルを配置
gcCalendarGrid1.Content[today].Rows[1].Cells[0].CellType = appointmentCellType1.Clone();
gcCalendarGrid1.Content[today].Rows[1].Cells[0].Value = "項目1";
gcCalendarGrid1.Content[today].Rows[1].Cells[0].ColumnSpan = 3;
gcCalendarGrid1.Content[today.AddDays(4)].Rows[1].Cells[0].CellType = appointmentCellType2.Clone();
gcCalendarGrid1.Content[today.AddDays(4)].Rows[1].Cells[0].Value = "項目2";
gcCalendarGrid1.Content[today.AddDays(4)].Rows[1].Cells[0].ColumnSpan = 3;
同一行のアポイントメント型セルに異なるバーの色を設定するには、実行時に複数のアポイントメント型セルを生成し、それぞれをセルに設定します。
[Visual Basic]
Imports GrapeCity.Win.CalendarGrid
Dim today As DateTime = DateTime.Today
' Appointment型セルの設定
Dim appointmentCellType1 As New CalendarAppointmentCellType()
appointmentCellType1.Renderer.FillColor = Color.Yellow
Dim appointmentCellType2 As New CalendarAppointmentCellType()
appointmentCellType2.Renderer.FillColor = Color.LightGreen
' CalendarGridにAppointment型セルを配置
GcCalendarGrid1.Content(today).Rows(1).Cells(0).CellType = appointmentCellType1.Clone()
GcCalendarGrid1.Content(today).Rows(1).Cells(0).Value = "項目1"
GcCalendarGrid1.Content(today).Rows(1).Cells(0).ColumnSpan = 3
GcCalendarGrid1.Content(today.AddDays(4)).Rows(1).Cells(0).CellType = appointmentCellType2.Clone()
GcCalendarGrid1.Content(today.AddDays(4)).Rows(1).Cells(0).Value = "項目2"
GcCalendarGrid1.Content(today.AddDays(4)).Rows(1).Cells(0).ColumnSpan = 3
[C#]
using GrapeCity.Win.CalendarGrid;
var today = DateTime.Today;
// Appointment型セルの設定
CalendarAppointmentCellType appointmentCellType1 = new CalendarAppointmentCellType();
appointmentCellType1.Renderer.FillColor = Color.Yellow;
CalendarAppointmentCellType appointmentCellType2 = new CalendarAppointmentCellType();
appointmentCellType2.Renderer.FillColor = Color.LightGreen;
// CalendarGridにAppointment型セルを配置
gcCalendarGrid1.Content[today].Rows[1].Cells[0].CellType = appointmentCellType1.Clone();
gcCalendarGrid1.Content[today].Rows[1].Cells[0].Value = "項目1";
gcCalendarGrid1.Content[today].Rows[1].Cells[0].ColumnSpan = 3;
gcCalendarGrid1.Content[today.AddDays(4)].Rows[1].Cells[0].CellType = appointmentCellType2.Clone();
gcCalendarGrid1.Content[today.AddDays(4)].Rows[1].Cells[0].Value = "項目2";
gcCalendarGrid1.Content[today.AddDays(4)].Rows[1].Cells[0].ColumnSpan = 3;