MESCIUS CalendarGrid for Windows Forms 4.0J > CalendarGridの使い方 > InputManCell > GcComboBox型セル > サンプルコード(CalendarGcComboBoxCellType) |
CalendarGcComboBoxCellTypeでは、ドロップダウンウィンドウを表示する方向を指定できます。次のコードではドロップダウンウィンドウを右側に表示します。
Imports InputManCell = GrapeCity.Win.CalendarGrid.InputMan Dim today As DateTime = DateTime.Today Dim GcComboBoxCellType As New InputManCell.CalendarGcComboBoxCellType() ' GcComboBoxCell にカラムを追加 GcComboBoxCellType.ListColumns.AddRange(New InputManCell.ListColumn() { New InputManCell.ListColumn("Column1"), New InputManCell.ListColumn("Column2")}) ' GcComboBoxCell に項目を追加 GcComboBoxCellType.Items.AddRange(New InputManCell.ListItem() { New InputManCell.ListItem(New InputManCell.SubItem() {New InputManCell.SubItem("01"), New InputManCell.SubItem("項目1")}), New InputManCell.ListItem(New InputManCell.SubItem() {New InputManCell.SubItem("02"), New InputManCell.SubItem("項目2")}), New InputManCell.ListItem(New InputManCell.SubItem() {New InputManCell.SubItem("03"), New InputManCell.SubItem("項目3")}), New InputManCell.ListItem(New InputManCell.SubItem() {New InputManCell.SubItem("04"), New InputManCell.SubItem("項目4")}) }) ' ドロップダウンウィンドウの表示方向を右に設定 GcComboBoxCellType.DropDown.Direction = InputManCell.DropDownDirection.Right GcCalendarGrid1.Content(today).Rows(1).Cells(0).CellType = GcComboBoxCellType GcCalendarGrid1.Content(today).Rows(1).Cells(0).CellStyle.BackColor = Color.Azure GcCalendarGrid1.ScrollIntoView(today)
using InputManCell = GrapeCity.Win.CalendarGrid.InputMan; var today = DateTime.Today; var gcComboBoxCellType = new InputManCell.CalendarGcComboBoxCellType(); // GcComboBoxCell にカラムを追加 gcComboBoxCellType.ListColumns.AddRange(new InputManCell.ListColumn[] { new InputManCell.ListColumn("Column1"), new InputManCell.ListColumn("Column2") }); // GcComboBoxCell に項目を追加 gcComboBoxCellType.Items.AddRange(new InputManCell.ListItem[] { new InputManCell.ListItem(new InputManCell.SubItem[] {new InputManCell.SubItem("01"), new InputManCell.SubItem("項目1")}), new InputManCell.ListItem(new InputManCell.SubItem[] {new InputManCell.SubItem("02"), new InputManCell.SubItem("項目2")}), new InputManCell.ListItem(new InputManCell.SubItem[] {new InputManCell.SubItem("03"), new InputManCell.SubItem("項目3")}), new InputManCell.ListItem(new InputManCell.SubItem[] {new InputManCell.SubItem("04"), new InputManCell.SubItem("項目4")}) }); // ドロップダウンウィンドウの表示方向を右に設定 gcComboBoxCellType.DropDown.Direction = InputManCell.DropDownDirection.Right; gcCalendarGrid1.Content[today].Rows[1].Cells[0].CellType = gcComboBoxCellType; gcCalendarGrid1.Content[today].Rows[1].Cells[0].CellStyle.BackColor = Color.Azure; gcCalendarGrid1.ScrollIntoView(today);