MESCIUS CalendarGrid for Windows Forms 4.0J > CalendarGridの使い方 > カレンダーの外観 > タイトルヘッダとタイトルフッタ |
CalendarGridでは、カレンダーの上部と下部にコンテンツを操作するためのボタンやラベルを配置できます。
上部のヘッダではGcCalendarGrid.TitleHeaderプロパティ、下部のフッタではGcCalendarGrid.TitleFooterプロパティを使用します。
Imports GrapeCity.Win.CalendarGrid Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load GcCalendarGrid1.TitleHeader.Children.Clear() GcCalendarGrid1.TitleFooter.Children.Clear() Dim caption1 As New CalendarTitleCaption() caption1.DateFormat = "yyyy年M月 (ggge年)" caption1.DateFormatType = CalendarDateFormatType.InputMan GcCalendarGrid1.TitleHeader.Children.Add(caption1) Dim gotoToddayButton As New CalendarTitleButton() gotoToddayButton.ButtonBehavior = CalendarTitleButtonBehavior.GotoToday ' 今日へ移動 gotoToddayButton.Text = "今日({0})へ移動" gotoToddayButton.ToolTipText = "{0}" gotoToddayButton.HorizontalAlignment = CalendarHorizontalAlignment.Right GcCalendarGrid1.TitleHeader.Children.Add(gotoToddayButton) Dim nextMonthButton As New CalendarTitleButton() nextMonthButton.ButtonBehavior = CalendarTitleButtonBehavior.Next nextMonthButton.Text = "次の月({0}) >>" nextMonthButton.ToolTipText = "{0}" nextMonthButton.HorizontalAlignment = CalendarHorizontalAlignment.Right GcCalendarGrid1.TitleHeader.Children.Add(nextMonthButton) Dim previousMonthButton As New CalendarTitleButton() previousMonthButton.ButtonBehavior = CalendarTitleButtonBehavior.Previous previousMonthButton.Text = "<< 前の月({0})" previousMonthButton.ToolTipText = "{0}" previousMonthButton.HorizontalAlignment = CalendarHorizontalAlignment.Right GcCalendarGrid1.TitleHeader.Children.Add(previousMonthButton) Dim customButton As New CalendarTitleButton() customButton.Text = "カスタムアクション" customButton.HorizontalAlignment = CalendarHorizontalAlignment.Stretch AddHandler customButton.Click, AddressOf customButton_Click GcCalendarGrid1.TitleFooter.Children.Add(customButton) End Sub Private Sub customButton_Click(sender As Object, e As EventArgs) MessageBox.Show("カスタムアクション") End Sub
using GrapeCity.Win.CalendarGrid; private void Form1_Load(object sender, EventArgs e) { gcCalendarGrid1.TitleHeader.Children.Clear(); gcCalendarGrid1.TitleFooter.Children.Clear(); var caption1 = new CalendarTitleCaption(); caption1.DateFormat = "yyyy年M月 (ggge年)"; caption1.DateFormatType = CalendarDateFormatType.InputMan; gcCalendarGrid1.TitleHeader.Children.Add(caption1); var gotoToddayButton = new CalendarTitleButton(); gotoToddayButton.ButtonBehavior = CalendarTitleButtonBehavior.GotoToday; gotoToddayButton.Text = "今日({0})へ移動"; // 今日へ移動 gotoToddayButton.ToolTipText = "{0}"; gotoToddayButton.HorizontalAlignment = CalendarHorizontalAlignment.Right; gcCalendarGrid1.TitleHeader.Children.Add(gotoToddayButton); var nextMonthButton = new CalendarTitleButton(); nextMonthButton.ButtonBehavior = CalendarTitleButtonBehavior.Next; nextMonthButton.Text = "次の月({0}) >>"; nextMonthButton.ToolTipText = "{0}"; nextMonthButton.HorizontalAlignment = CalendarHorizontalAlignment.Right; gcCalendarGrid1.TitleHeader.Children.Add(nextMonthButton); var previousMonthButton = new CalendarTitleButton(); previousMonthButton.ButtonBehavior = CalendarTitleButtonBehavior.Previous; previousMonthButton.Text = "<< 前の月({0})"; previousMonthButton.ToolTipText = "{0}"; previousMonthButton.HorizontalAlignment = CalendarHorizontalAlignment.Right; gcCalendarGrid1.TitleHeader.Children.Add(previousMonthButton); var customButton = new CalendarTitleButton(); customButton.Text = "カスタムアクション"; customButton.HorizontalAlignment = CalendarHorizontalAlignment.Stretch; customButton.Click += customButton_Click; gcCalendarGrid1.TitleFooter.Children.Add(customButton); } private void customButton_Click(object sender, EventArgs e) { MessageBox.Show("カスタムアクション"); }