ToolStripItem.MergeIndex プロパティ

定義

現在の 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

プロパティ値

一致が見つかった場合は、マージされた項目のインデックスを表す整数。一致が見つからなかった場合は -1。

次の例では、 プロパティを MergeIndex 使用して、マージされた ToolStripMenuItem を特定の場所に挿入します。 この例は、クラスの概要で使用できる大きな例の ToolStripManager 一部です。

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

注釈

プロパティを MergeIndex 使用して の ToolStripMenuItem インデックスを取得または設定し、メニューのマージ操作にアクセスできるようにします。

適用対象