本文整理汇总了C#中System.Windows.Forms.ToolStripItemCollection.IndexOfKey方法的典型用法代码示例。如果您正苦于以下问题:C# ToolStripItemCollection.IndexOfKey方法的具体用法?C# ToolStripItemCollection.IndexOfKey怎么用?C# ToolStripItemCollection.IndexOfKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ToolStripItemCollection
的用法示例。
在下文中一共展示了ToolStripItemCollection.IndexOfKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DBSelect_LoadingLists_Reset
private int DBSelect_LoadingLists_Reset()
{
DataTable openedLists = new DataTable();
using (OleDbDataAdapter adapter = new OleDbDataAdapter("Select * from LoadingListOpened_View", conn))
{
adapter.SelectCommand.Parameters.Add("@stock_id", OleDbType.Integer).Value = getStockId();
adapter.Fill(openedLists);
}
openedLists.PrimaryKey = new DataColumn[] { openedLists.Columns[openedLists.Columns.IndexOf("id")] };
//checking for contained buttons, remove not existing in db
KryptonCheckButton[] buttons = new KryptonCheckButton[openedLists.Rows.Count];
ToolStripMenuItem[] items = new ToolStripMenuItem[openedLists.Rows.Count];
foreach (DataRow row in openedLists.Rows)
{
long listId = long.Parse(row.ItemArray[openedLists.Columns.IndexOf("id")].ToString());
string index = (string)row.ItemArray[openedLists.Columns.IndexOf("index")];
KryptonCheckButton button = CreateLoadingListButton(listId, index);
if (!flpControls.Controls.ContainsKey(button.Name))
{
//buttons[openedLists.Rows.IndexOf(row)] = button;
flpControls.Controls.Add(button);
tsmiLL.DropDownItems.Insert(tsmiLL.DropDownItems.IndexOf(tsmiHistorySeparator), newLoadingListMenuItem(listId, index));
newLoadingListToolStripItem(listId, index);
}
}
ToolStripItemCollection col2 = new ToolStripItemCollection(cmsLoadingLists, ((ToolStripItem[])cmsLoadingLists.Tag));
foreach (Control control in flpControls.Controls)
{
if (!openedLists.Rows.Contains(control.Tag))
{
flpControls.Controls.RemoveAt(flpControls.Controls.IndexOfKey(control.Name));
col2.RemoveAt(col2.IndexOfKey(csLoadingList.CheckedButton.Name));
col2.CopyTo((ToolStripItem[])cmsLoadingLists.Tag, 0);
tsmiLL.DropDownItems.RemoveAt(tsmiLL.DropDownItems.IndexOfKey(control.Name));
}
}
//flpControls.Controls.AddRange(buttons);
return openedLists.Rows.Count;
}
示例2: newLoadingListToolStripItem
private ToolStripItem newLoadingListToolStripItem(long listId, String index)
{
ToolStripMenuItem item = new ToolStripMenuItem(LL_DeserializeName(index), WarehouseApp.Properties.Resources.table, null, "l" + listId);
item.Tag = listId;
item.Click += new System.EventHandler(LoadingList_MoveToSelected_Click);
Events_LoadingListButton(item);
if (cmsLoadingLists.Tag != null)
{
ToolStripItemCollection col2 = new ToolStripItemCollection(cmsLoadingLists, ((ToolStripItem[])cmsLoadingLists.Tag));
if (col2.IndexOfKey(item.Name) == -1)
{
col2.Insert(col2.IndexOf(tsmiNewLL), item);
cmsLoadingLists.Tag = new ToolStripItem[col2.Count];
col2.CopyTo((ToolStripItem[])cmsLoadingLists.Tag, 0);
}
}
return item;
}