ToolStripItem.ImageIndex Özellik
Tanım
Öğede görüntülenen görüntünün dizin değerini alır veya ayarlar.Gets or sets the index value of the image that is displayed on the item.
public:
property int ImageIndex { int get(); void set(int value); };
[System.ComponentModel.Browsable(false)]
[System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.NoneExcludedImageIndexConverter))]
[System.Windows.Forms.RelatedImageList("Owner.ImageList")]
public int ImageIndex { get; set; }
[<System.ComponentModel.Browsable(false)>]
[<System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.NoneExcludedImageIndexConverter))>]
[<System.Windows.Forms.RelatedImageList("Owner.ImageList")>]
member this.ImageIndex : int with get, set
Public Property ImageIndex As Integer
Özellik Değeri
Öğesi için görüntülenen içindeki görüntünün sıfır tabanlı dizini ImageList .The zero-based index of the image in the ImageList that is displayed for the item. Varsayılan değer-1 ' dir ve görüntü listesinin boş olduğunu gösterir.The default is -1, signifying that the image list is empty.
- Öznitelikler
Özel durumlar
value
-1 ' den küçük.value
is less than -1.
Açıklamalar
ImageKeyImageIndexbirbirini dışlıyor, biri ayarlandıysa, diğeri geçersiz bir değere ayarlanır ve yok sayılır.ImageKey and ImageIndex are mutually exclusive, meaning if one is set, the other is set to an invalid value and ignored. ImageKeyÖzelliği ayarlarsanız, ImageIndex özelliği otomatik olarak-1 ' e ayarlanır.If you set the ImageKey property, the ImageIndex property is automatically set to -1. Alternatif olarak, özelliğini ayarlarsanız, ImageIndex ImageKey otomatik olarak boş bir dizeye ayarlanır ("").Alternatively, if you set the ImageIndex property, the ImageKey is automatically set to an empty string ("").
Image,, ImageAlign , ImageIndex ImageKey Ve ImageScaling özellikleri görüntü işlemenin çeşitli yönlerini sağlar.The Image, ImageAlign, ImageIndex, ImageKey, and ImageScaling properties pertain to various aspects of image handling. ToolStripBu özellikleri doğrudan ayarlayarak veya yalnızca çalışma zamanı özelliğini ayarlayarak denetimlerde görüntüleri kullanın ImageList .Use images in ToolStrip controls by setting these properties directly or by setting the run-time-only ImageList property.
Görüntü ölçekleme, ToolStrip aşağıdaki gibi, ve özelliklerinin her ikisi de ile etkileşime göre belirlenir ToolStripItem :Image scaling is determined by the interaction of properties in both ToolStrip and ToolStripItem, as follows:
ImageScalingSize , görüntünün ImageScaling ayarı ve kapsayıcının ayarı birleşimine göre belirlenen şekilde nihai görüntünün ölçeklendirilmesine sahiptir AutoSize .ImageScalingSize is the scale of the final image as determined by the combination of the image's ImageScaling setting and the container's AutoSize setting.
İse AutoSize
true
(varsayılan) ve ToolStripItemImageScaling ise SizeToFit , görüntü ölçekleme gerçekleşmez ve ToolStrip boyut en büyük öğe veya önceden tanımlanmış en küçük boyut olur.If AutoSize istrue
(the default) and ToolStripItemImageScaling is SizeToFit, no image scaling occurs, and the ToolStrip size is that of the largest item, or a prescribed minimum size., AutoSize Ve ise,
false
ToolStripItemImageScaling None ne görüntü ne de ToolStrip ölçekleme gerçekleşmez.If AutoSize isfalse
and ToolStripItemImageScaling is None, neither image nor ToolStrip scaling occurs.
ImageListÖzellik değeri olarak değiştirilirse null
ImageIndex özellik,-1 varsayılan değerini döndürür.If the ImageList property value is changed to null
, the ImageIndex property returns its default value, -1. Ancak atanan ImageIndex değer dahili olarak tutulur ve özelliğe başka bir ImageList nesne atandığında kullanılır ImageList .However, the assigned ImageIndex value is retained internally and used when another ImageList object is assigned to the ImageList property. Özelliğe atanan yeni bir özellik değeri varsa, özelliğe ImageList ImageList ImageList.ImageCollection.Count atanan değerden küçük veya ona eşit olan bir özellik değeri varsa ImageIndex (koleksiyonun sıfır tabanlı bir dizin olması için), ImageIndex özellik değeri özellik değerinden bir daha küçük olarak ayarlanır Count .If the new ImageList assigned to the ImageList property has an ImageList.ImageCollection.Count property value that is less than or equal to the value assigned to the ImageIndex property minus one (to account for the collection being a zero-based index), the ImageIndex property value is adjusted to one less than the Count property value.
Örneğin, ImageList üç görüntüsü olan ve ImageIndex özelliği 2 olarak ayarlanmış olan bir düğme denetimini düşünün.For example, consider a button control whose ImageList has three images and whose ImageIndex property is set to 2. ImageListDüğmeye yalnızca iki görüntü atanmış yeni bir değer varsa, ImageIndex değer 1 olarak değişir.If a new ImageList that has only two images is assigned to the button, the ImageIndex value changes to 1.