ButtonBase.ImageList Özellik
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
public:
property System::Windows::Forms::ImageList ^ ImageList { System::Windows::Forms::ImageList ^ get(); void set(System::Windows::Forms::ImageList ^ value); };
public System.Windows.Forms.ImageList ImageList { get; set; }
public System.Windows.Forms.ImageList? ImageList { get; set; }
member this.ImageList : System.Windows.Forms.ImageList with get, set
Public Property ImageList As ImageList
Özellik Değeri
Bir ImageList.
null varsayılan değerdir.
Örnekler
Aşağıdaki kod örneği türetilmiş sınıfını Button kullanır ve ve ImageList özelliklerini ayarlarImageIndex. Bu kod, bir ImageList oluşturulmasını ve en az bir tane Image atanmış olmasını gerektirir. Bu kod ayrıca dizininde MyBitMap.bmp depolanan adlı C:\Graphics bir bit eşlem görüntüye sahip olmanız gerekir.
private:
void AddMyImage()
{
// Assign an image to the imageList.
imageList1->Images->Add( Image::FromFile( "C:\\Graphics\\MyBitmap.bmp" ) );
// Assign the imageList to the button control.
button1->ImageList = imageList1;
// Select the image from the ImageList (using the ImageIndex property).
button1->ImageIndex = 0;
}
private void AddMyImage()
{
// Assign an image to the ImageList.
ImageList1.Images.Add(Image.FromFile("C:\\Graphics\\MyBitmap.bmp"));
// Assign the ImageList to the button control.
button1.ImageList = ImageList1;
// Select the image from the ImageList (using the ImageIndex property).
button1.ImageIndex = 0;
}
Private Sub AddMyImage()
' Assign an image to the ImageList.
ImageList1.Images.Add(Image.FromFile("C:\Graphics\MyBitmap.bmp"))
' Assign the ImageList to the button control.
button1.ImageList = ImageList1
' Select the image from the ImageList (using the ImageIndex property).
button1.ImageIndex = 0
End Sub
Açıklamalar
ImageList veya ImageIndex özelliği ayarlandığında, Image özelliği varsayılan değeri olan olarak ayarlanırnull.
Note
ImageList Özellik değeri olarak nullImageIndex değiştirilirse, özellik varsayılan değeri olan -1 değerini döndürür. Ancak, atanan ImageIndex değer dahili olarak tutulur ve başka bir ImageList özellik atandığında ImageList kullanılır. Özelliğe atanan yeni ImageList özelliğinImageList, özelliğe atanan ImageList.ImageCollection.Count değerden küçük veya buna eşit bir ImageIndex özellik değeri varsa (koleksiyon sıfır tabanlı bir dizin olduğundan), ImageIndex özellik değeri özellik değerinden Count bir küçük değere ayarlanır. Örneğin, üç görüntüsü olan ImageList ve ImageIndex özelliği 2 olarak ayarlanmış bir düğme denetimi düşünün. Düğmeye yalnızca iki resim içeren bir yeni ImageList atanırsa, ImageIndex değer 1 olarak değişir.