作成日: 2024/01/19 最終更新日: 2024/01/31
文書種別
使用方法
詳細
CalendarGridでは、Button型セルのボタンがクリックされたときに発生するCellContentButtonClickイベントを提供しているので、このイベントを利用することで、Button型セルのクリックを処理できます。
[Visual Basic]
Imports GrapeCity.Win.CalendarGrid
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim today As DateTime = DateTime.Today
Dim ButtonCellType As New CalendarButtonCellType()
GcCalendarGrid1.Content(today).Rows(1).Cells(0).CellType = ButtonCellType.Clone()
GcCalendarGrid1.Content(today).Rows(1).Cells(0).Value = "ボタン"
End Sub
Private Sub GcCalendarGrid1_CellContentButtonClick(sender As Object, e As CalendarCellEventArgs) Handles GcCalendarGrid1.CellContentButtonClick
MessageBox.Show(String.Format("クリックされたセル : {0}", e.CellPosition.ToString()))
End Sub
[C#]
using GrapeCity.Win.CalendarGrid;
private void Form1_Load(object sender, EventArgs e)
{
DateTime today = DateTime.Today;
CalendarButtonCellType ButtonCellType = new CalendarButtonCellType();
gcCalendarGrid1.Content[today].Rows[1].Cells[0].CellType = ButtonCellType.Clone();
gcCalendarGrid1.Content[today].Rows[1].Cells[0].Value = "ボタン";
gcCalendarGrid1.CellContentButtonClick += gcCalendarGrid1_CellContentButtonClick;
}
private void gcCalendarGrid1_CellContentButtonClick(object sender, CalendarCellEventArgs e)
{
MessageBox.Show(string.Format("クリックされたセル : {0}", e.CellPosition.ToString()));
}
[Visual Basic]
Imports GrapeCity.Win.CalendarGrid
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim today As DateTime = DateTime.Today
Dim ButtonCellType As New CalendarButtonCellType()
GcCalendarGrid1.Content(today).Rows(1).Cells(0).CellType = ButtonCellType.Clone()
GcCalendarGrid1.Content(today).Rows(1).Cells(0).Value = "ボタン"
End Sub
Private Sub GcCalendarGrid1_CellContentButtonClick(sender As Object, e As CalendarCellEventArgs) Handles GcCalendarGrid1.CellContentButtonClick
MessageBox.Show(String.Format("クリックされたセル : {0}", e.CellPosition.ToString()))
End Sub
[C#]
using GrapeCity.Win.CalendarGrid;
private void Form1_Load(object sender, EventArgs e)
{
DateTime today = DateTime.Today;
CalendarButtonCellType ButtonCellType = new CalendarButtonCellType();
gcCalendarGrid1.Content[today].Rows[1].Cells[0].CellType = ButtonCellType.Clone();
gcCalendarGrid1.Content[today].Rows[1].Cells[0].Value = "ボタン";
gcCalendarGrid1.CellContentButtonClick += gcCalendarGrid1_CellContentButtonClick;
}
private void gcCalendarGrid1_CellContentButtonClick(object sender, CalendarCellEventArgs e)
{
MessageBox.Show(string.Format("クリックされたセル : {0}", e.CellPosition.ToString()));
}