Bagikan melalui


ToolStripItem.MergeIndex Properti

Definisi

Mendapatkan atau mengatur posisi item gabungan dalam .ToolStrip

public:
 property int MergeIndex { int get(); void set(int value); };
public int MergeIndex { get; set; }
member this.MergeIndex : int with get, set
Public Property MergeIndex As Integer

Nilai Properti

Bilangan bulat yang mewakili indeks item gabungan, jika kecocokan ditemukan, atau -1 jika kecocokan tidak ditemukan.

Contoh

Contoh berikut menggunakan MergeIndex properti untuk menyisipkan gabungan ToolStripMenuItem di lokasi tertentu. Contoh ini adalah bagian dari contoh yang lebih besar yang tersedia dalam ToolStripManager gambaran umum kelas.

public void ShowInsertInSameLocationSample()
{
    // Notice how the items are in backward order.  
    // This is because "merge-one" gets applied, then a search occurs for the new second position 
    // for "merge-two", and so on.
    foreach (ToolStripItem item in cmsItemsToMerge.Items)
    {
        item.MergeAction = MergeAction.Insert;
        item.MergeIndex = 2;
    }
}
Public Sub ShowInsertInSameLocationSample()
   ' Notice how the items are in backward order.  
   ' This is because "merge-one" gets applied, then a search occurs for the new second position 
   ' for "merge-two", and so on.
   Dim item As ToolStripItem
   For Each item In  cmsItemsToMerge.Items
      item.MergeAction = MergeAction.Insert
      item.MergeIndex = 2
   Next item
End Sub

Keterangan

MergeIndex Gunakan properti untuk mendapatkan atau mengatur indeks ToolStripMenuItem sehingga Anda dapat mengaksesnya untuk operasi penggabungan menu.

Berlaku untuk