作成日: 2014/09/26 最終更新日: 2014/09/26
文書種別
使用方法
詳細
C1Schedule.BeforeTimeFormatイベントでイベント引数を設定することで、特定の日だけ背景色を変更することが可能です。
実行例 (月ビュー)
実行例 (週ビュー)
サンプルコード (Visual Basic)
サンプルコード (C#)
実行例 (月ビュー)
実行例 (週ビュー)
サンプルコード (Visual Basic)
Imports C1.Win.C1Schedule
Private Sub C1Schedule1_BeforeTimeFormat(sender As System.Object, e As BeforeTimeFormatEventArgs) Handles C1Schedule1.BeforeTimeFormat
If e.Start.DayOfWeek = DayOfWeek.Sunday Then
' 日曜日の背景色を赤に変更します。
e.Background = Color.Red
ElseIf e.Start.DayOfWeek = DayOfWeek.Saturday Then
' 土曜日の背景色を青に変更します。
e.Background = Color.Blue
ElseIf e.Start.Date = DateTime.Today Then
' 今日の背景色を緑に変更します。
e.Background = Color.Green
End If
End Sub
Private Sub C1Schedule1_BeforeTimeFormat(sender As System.Object, e As BeforeTimeFormatEventArgs) Handles C1Schedule1.BeforeTimeFormat
If e.Start.DayOfWeek = DayOfWeek.Sunday Then
' 日曜日の背景色を赤に変更します。
e.Background = Color.Red
ElseIf e.Start.DayOfWeek = DayOfWeek.Saturday Then
' 土曜日の背景色を青に変更します。
e.Background = Color.Blue
ElseIf e.Start.Date = DateTime.Today Then
' 今日の背景色を緑に変更します。
e.Background = Color.Green
End If
End Sub
サンプルコード (C#)
using C1.Win.C1Schedule;
private void c1Schedule1_BeforeTimeFormat(object sender, BeforeTimeFormatEventArgs e)
{
if (e.Start.DayOfWeek == DayOfWeek.Sunday)
{
// 日曜日の背景色を赤に変更します。
e.Background = Color.Red;
}
else if (e.Start.DayOfWeek == DayOfWeek.Saturday)
{
// 土曜日の背景色を青に変更します。
e.Background = Color.Blue;
}
else if (e.Start.Date == DateTime.Today)
{
// 今日の背景色を緑に変更します。
e.Background = Color.Green;
}
}
private void c1Schedule1_BeforeTimeFormat(object sender, BeforeTimeFormatEventArgs e)
{
if (e.Start.DayOfWeek == DayOfWeek.Sunday)
{
// 日曜日の背景色を赤に変更します。
e.Background = Color.Red;
}
else if (e.Start.DayOfWeek == DayOfWeek.Saturday)
{
// 土曜日の背景色を青に変更します。
e.Background = Color.Blue;
}
else if (e.Start.Date == DateTime.Today)
{
// 今日の背景色を緑に変更します。
e.Background = Color.Green;
}
}
関連情報
旧文書番号
71069