GrapeCity SPREAD for Windows Forms 12.0J
UnSelectedImageIndex プロパティ


ユーザーがドロップダウンリストで項目を選択していないときにエディタ領域に表示される画像のインデックスを取得または設定します。
構文
'Declaration
 
Public Property UnSelectedImageIndex As Integer
'使用法
 
Dim instance As GcComboBoxCellType
Dim value As Integer
 
instance.UnSelectedImageIndex = value
 
value = instance.UnSelectedImageIndex
public int UnSelectedImageIndex {get; set;}

プロパティ値

画像インデックスを示すSystem.Int32値。
デフォルト値は-1です。
解説
SelectedItemがnull 参照 (Visual Basicでは Nothing)で、TextBoxStyleプロパティがTextBoxStyle.ImageOnlyまたはTextBoxStyle.Bothの場合、このインデックス値に基づいて編集領域に画像が表示されます。
次のサンプルコードは、リストがドロップダウンしたときに何も選択されていない場合、編集領域に画像を表示します。
ImageList img = new ImageList();
img.Images.Add(Image.FromFile("C:\\Program Files (x86)\\GrapeCity\\rasp.png"));
img.Images.Add(Image.FromFile("C:\\Program Files (x86)\\GrapeCity\\vanilla.png"));
img.Images.Add(Image.FromFile("C:\\Program Files (x86)\\GrapeCity\\choco.png"));
img.Images.Add(Image.FromFile("C:\\Program Files (x86)\\GrapeCity\\banana.png"));

GrapeCity.Win.Spread.InputMan.CellType.GcComboBoxCellType gccombo = new GrapeCity.Win.Spread.InputMan.CellType.GcComboBoxCellType();
gccombo.DropDownStyle = ComboBoxStyle.DropDownList;
gccombo.Items.AddRange(new String[] { "Raspberry", "Vanilla", "Chocolate", "Banana" });
gccombo.Items[0].BackColor = Color.Fuchsia;
gccombo.Items[1].BackColor = Color.Ivory;
gccombo.Items[2].BackColor = Color.Chocolate;
gccombo.Items[3].BackColor = Color.LightYellow;
gccombo.ImageList = img;
gccombo.Items[0].Image = 0;
gccombo.Items[1].Image = 1;
gccombo.Items[2].Image = 2;
gccombo.Items[3].Image = 3;
gccombo.ShowListBoxImage = true;
gccombo.ImageAlign = HorizontalAlignment.Right;
gccombo.ListSelectedItemStyle.BackColor = Color.Bisque;
gccombo.ListSelectedItemStyle.ForeColor = Color.Black;
gccombo.UnSelectedImageIndex = 1;
gccombo.TextBoxStyle = GrapeCity.Win.Spread.InputMan.CellType.TextBoxStyle.Both;
fpSpread1.Sheets[0].Cells[1, 1].CellType = gccombo;
fpSpread1.Sheets[0].Columns[1].Width = 200;
fpSpread1.Sheets[0].Rows[1].Height = 40;
Dim img As New ImageList()
img.Images.Add(Image.FromFile("C:\Program Files (x86)\GrapeCity\rasp.png"))
img.Images.Add(Image.FromFile("C:\Program Files (x86)\GrapeCity\vanilla.png"))
img.Images.Add(Image.FromFile("C:\Program Files (x86)\GrapeCity\choco.png"))
img.Images.Add(Image.FromFile("C:\Program Files (x86)\GrapeCity\banana.png"))

Dim gccombo As New GrapeCity.Win.Spread.InputMan.CellType.GcComboBoxCellType()
gccombo.DropDownStyle = ComboBoxStyle.DropDownList
gccombo.Items.AddRange(New String() {"Raspberry", "Vanilla", "Chocolate", "Banana"})
gccombo.Items(0).BackColor = Color.Fuchsia
gccombo.Items(1).BackColor = Color.Ivory
gccombo.Items(2).BackColor = Color.Chocolate
gccombo.Items(3).BackColor = Color.LightYellow
gccombo.ImageList = img
gccombo.Items(0).Image = 0
gccombo.Items(1).Image = 1
gccombo.Items(2).Image = 2
gccombo.Items(3).Image = 3
gccombo.ShowListBoxImage = True
gccombo.ImageAlign = HorizontalAlignment.Right
gccombo.ListSelectedItemStyle.BackColor = Color.Bisque
gccombo.ListSelectedItemStyle.ForeColor = Color.Black
gccombo.UnSelectedImageIndex = 1
gccombo.TextBoxStyle = GrapeCity.Win.Spread.InputMan.CellType.TextBoxStyle.Both
FpSpread1.Sheets(0).Cells(1, 1).CellType = gccombo
FpSpread1.Sheets(0).Columns(1).Width = 200
FpSpread1.Sheets(0).Rows(1).Height = 40
参照

GcComboBoxCellType クラス
GcComboBoxCellType メンバ

 

 


Copyright © 2004 GrapeCity inc.