SPREAD for ASP.NET 8.0J サンプルコード集 > セル型 > コンボボックス型セル > コンボボックスの背景色/文字色を変更する |
コンボボックス型セルのCssClassプロパティにスタイルシートを設定します。
//コンボボックスは編集時に表示されます ComboBoxCellType cbCell = new ComboBoxCellType() { Items = new string[] { "要素1", "要素2", "要素3" }, CssClass="mycombo" }; FpSpread1.Cells[0, 1].CellType = cbCell; //コンボボックスを常に表示するよう設定します ComboBoxCellType cbCell2 = new ComboBoxCellType() { Items = new string[] { "要素1", "要素2", "要素3" }, ShowButton = true, CssClass = "mycombo" }; FpSpread1.Cells[0, 2].CellType = cbCell2;
'コンボボックスは編集時に表示されます Dim cbCell As New ComboBoxCellType() With { .Items = New String() {"要素1", "要素2", "要素3"}, .CssClass = "mycombo" } FpSpread1.Cells(0, 1).CellType = cbCell 'コンボボックスを常に表示するよう設定します Dim cbCell2 As New ComboBoxCellType() With { .Items = New String() {"要素1", "要素2", "要素3"}, .ShowButton = True, .CssClass = "mycombo" } FpSpread1.Cells(0, 2).CellType = cbCell2
<!--スタイルシートでコンボボックスのフォントを設定します--> <style type="text/css"> .mycombo select{ color:blue; background-color:lightblue } </style>