作成日: 2020/03/16 最終更新日: 2020/03/16
文書種別
使用方法
詳細
タイムラインビューで、左側の列に表示されるタイトルのテキスト配置を、Outlookのように上揃えにするには、グループヘッダーが書式設定される前に発生するBeforeGroupHeaderFormatイベントで、グループヘッダーのスタイルのVerticalAlignmentを「Near」に設定します。
◎サンプルコード(VB)
◎サンプルコード(VB)
Imports C1.Win.C1Schedule
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' 左側タイトルのデフォルト値を設定
C1Schedule1.EmptyGroupName = "グレープシティ"
' タイムライン表示の指定
C1Schedule1.ViewType = ScheduleViewEnum.TimeLineView
' 予定の設定
Dim i As Integer = 0
For i = 0 To 49
Dim app = C1Schedule1.DataStorage.AppointmentStorage.Appointments.Add
app.Start = DateTime.Now
app.End = app.Start.AddHours(1)
app.Subject = String.Format("aa -{0,2}", i)
Next i
' 最初に表示する時刻を指定
C1Schedule1.Settings.FirstVisibleTime = New TimeSpan(8, 0, 0)
End Sub
Private Sub C1Schedule1_BeforeGroupHeaderFormat(sender As Object, e As C1.Win.C1Schedule.BeforeGroupHeaderFormatEventArgs) Handles C1Schedule1.BeforeGroupHeaderFormat
Dim modifiedStyle As C1.Framework.Style = New C1.Framework.Style
modifiedStyle.Hot = e.Style.Hot
modifiedStyle.Hot.VerticalAlignment = C1.Framework.Alignment.Near '上揃え
'
e.Style = modifiedStyle
End Sub
End Class
◎サンプルコード(C#)using C1.Win.C1Schedule;
namespace prj_C1Schedule
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// 左側タイトルのデフォルト値を設定
c1Schedule1.EmptyGroupName = "グレープシティ";
// タイムライン表示の指定
c1Schedule1.ViewType = ScheduleViewEnum.TimeLineView;
// 予定の設定
for (int i = 0; i < 50; i++)
{
var app = c1Schedule1.DataStorage.AppointmentStorage.Appointments.Add();
app.Start = DateTime.Now;
app.End = app.Start.AddHours(1);
app.Subject = String.Format("aa -{0,2}", i);
}
// 最初に表示する時刻を指定
c1Schedule1.Settings.FirstVisibleTime = new TimeSpan(8, 0, 0);
}
private void c1Schedule1_BeforeGroupHeaderFormat_1(object sender, BeforeGroupHeaderFormatEventArgs e)
{
// グループタイトルのテキスト配置の設定
C1.Framework.Style modifiedStyle = new C1.Framework.Style();
modifiedStyle.Hot = e.Style.Hot;
modifiedStyle.Hot.VerticalAlignment = C1.Framework.Alignment.Near; //上揃え
e.Style = modifiedStyle;
}
}
}
関連情報
旧文書番号
85021