| SPREAD for Windows Forms 10.0J サンプルコード集 > セル型 > コンボボックス型セル > ドロップダウンリストにアイコンを表示させる |
ComboBoxCellTypeクラスのImageListプロパティに作成したイメージリストを設定することにより、ドロップダウンリストの各項目の先頭にアイコンを表示させることができます。

![]() |
|
private void Form1_Load(object sender, System.EventArgs e) { //イメージリストの生成 ImageList iList = new ImageList(); iList.Images.Add(Image.FromFile("アイコンパス名1")); iList.Images.Add(Image.FromFile("アイコンパス名2")); iList.Images.Add(Image.FromFile("アイコンパス名3")); //コンボボックス型セルの定義 FarPoint.Win.Spread.CellType.ComboBoxCellType c = new FarPoint.Win.Spread.CellType.ComboBoxCellType(); c.ListWidth = 100; c.Editable = true; c.Items = new String[] {"歴史", "音楽", "科学"}; //イメージリストの設定 c.ImageList = iList; fpSpread1.ActiveSheet.Cells[1, 1].CellType = c; }
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load 'イメージリストの生成 Dim iList As New ImageList iList.Images.Add(Image.FromFile("アイコンパス名1")) iList.Images.Add(Image.FromFile("アイコンパス名2")) iList.Images.Add(Image.FromFile("アイコンパス名3")) 'コンボボックス型セルの定義 Dim c As New FarPoint.Win.Spread.CellType.ComboBoxCellType c.ListWidth = 100 c.Editable = True c.Items = New String() {"歴史", "音楽", "科学"} 'イメージリストの設定 c.ImageList = iList FpSpread1.ActiveSheet.Cells(1, 1).CellType = c End Sub