private void Form1_Load(object sender, System.EventArgs e)
{
// データセットを作成します
DataTable dt = new DataTable("SampleTable");
dt.Columns.Add("ColumnA", Type.GetType("System.Int32"));
dt.Columns.Add("ColumnB", Type.GetType("System.String"));
dt.Rows.Add(100, "AAA");
dt.Rows.Add(200, "BBB");
dt.Rows.Add(300, "CCC");
dt.AcceptChanges();
// マルチカラムコンボボックス型セルを設定します
FarPoint.Win.Spread.CellType.MultiColumnComboBoxCellType mc = new FarPoint.Win.Spread.CellType.MultiColumnComboBoxCellType();
mc.DataSourceList = dt;
fpSpread1.ActiveSheet.Cells[1, 1].CellType = mc;
fpSpread1.ActiveSheet.Columns[1].Width = 130;
}
private void fpSpread1_EditModeOn(object sender, EventArgs e)
{
// アクティブセルのセル型を判断します
int row = fpSpread1.ActiveSheet.ActiveRowIndex;
int col = fpSpread1.ActiveSheet.ActiveColumnIndex;
if (fpSpread1.ActiveSheet.GetCellType(row, col) is FarPoint.Win.Spread.CellType.MultiColumnComboBoxCellType)
{
// ドロップダウンリストのオブジェクトを取得します
FarPoint.Win.Spread.FpSpread cmbSpread = (FarPoint.Win.Spread.FpSpread)((FarPoint.Win.Spread.CellType.GeneralEditor)fpSpread1.EditingControl).SubEditor;
// 1列目の幅と色を設定します
cmbSpread.ActiveSheet.Columns[0].Width = 60;
cmbSpread.ActiveSheet.Columns[0].BackColor = Color.LightPink;
// 2列目の幅と色を設定します
cmbSpread.ActiveSheet.Columns[1].Width = 60;
cmbSpread.ActiveSheet.Columns[1].BackColor = Color.LightCyan;
}
}
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
' データセットを作成します
Dim dt As New DataTable("SampleTable")
dt.Columns.Add("ColumnA", Type.GetType("System.Int32"))
dt.Columns.Add("ColumnB", Type.GetType("System.String"))
dt.Rows.Add(100, "AAA")
dt.Rows.Add(200, "BBB")
dt.Rows.Add(300, "CCC")
dt.AcceptChanges()
' マルチカラムコンボボックス型セルを設定します
Dim mc As New FarPoint.Win.Spread.CellType.MultiColumnComboBoxCellType
mc.DataSourceList = dt
FpSpread1.ActiveSheet.Cells(1, 1).CellType = mc
FpSpread1.ActiveSheet.Columns(1).Width = 130
End Sub
Private Sub FpSpread1_EditModeOn(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FpSpread1.EditModeOn
'アクティブセルのセル型を判断します
Dim row As Integer = FpSpread1.ActiveSheet.ActiveRowIndex
Dim col As Integer = FpSpread1.ActiveSheet.ActiveColumnIndex
If TypeOf (FpSpread1.ActiveSheet.GetCellType(row, col)) Is FarPoint.Win.Spread.CellType.MultiColumnComboBoxCellType Then
' ドロップダウンリストのオブジェクトを取得します
Dim cmbSpread As FarPoint.Win.Spread.FpSpread = CType(FpSpread1.EditingControl, FarPoint.Win.Spread.CellType.GeneralEditor).SubEditor
'1列目の幅と色を設定します
cmbSpread.ActiveSheet.Columns(0).Width = 60
cmbSpread.ActiveSheet.Columns(0).BackColor = Color.LightPink
'2列目の幅と色を設定します
cmbSpread.ActiveSheet.Columns(1).Width = 60
cmbSpread.ActiveSheet.Columns(1).BackColor = Color.LightCyan
End If
End Sub