本文整理匯總了C#中System.Windows.Forms.ToolStripItemCollection.CopyTo方法的典型用法代碼示例。如果您正苦於以下問題:C# ToolStripItemCollection.CopyTo方法的具體用法?C# ToolStripItemCollection.CopyTo怎麽用?C# ToolStripItemCollection.CopyTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Forms.ToolStripItemCollection
的用法示例。
在下文中一共展示了ToolStripItemCollection.CopyTo方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}
示例3: CombineItems_ContextMenu
public static ContextMenuStrip CombineItems_ContextMenu(ContextMenuStrip[] cmsTargets, CancelEventHandler[] eventsOpening)
{
ContextMenuStrip cmsBlank = new ContextMenuStrip();//components
cmsBlank.Font = new System.Drawing.Font("Segoe UI", 8.25F);
cmsBlank.Name = "cmsBlank";
cmsBlank.Size = new System.Drawing.Size(153, 26);
if (eventsOpening != null)
{
cmsBlank.Opening += delegate(object sender, CancelEventArgs e)
{
foreach (CancelEventHandler eventOpening in eventsOpening)
{
if (!e.Cancel)
{
eventOpening(sender, e);
}
else
{
break;
}
}
};
}
foreach (ContextMenuStrip strip in cmsTargets)
{
if (strip.Tag == null)
{
strip.Tag = new ToolStripItem[strip.Items.Count];
strip.Items.CopyTo((ToolStripItem[])strip.Tag, 0);
}
ToolStripItemCollection stripItems = new ToolStripItemCollection(strip, ((ToolStripItem[])strip.Tag));
ToolStripItem[] items = new ToolStripItem[stripItems.Count];
if (items.Length == 0 && strip.Tag != null)
{
items = (ToolStripItem[])strip.Tag;
}
stripItems.CopyTo(items, 0);
strip.Tag = items;
cmsBlank.Items.AddRange(items);
cmsBlank.Tag = items;
}
return cmsBlank;
}
示例4: MoveToolStripItems
private static void MoveToolStripItems(ToolStripItemCollection from, ToolStripItemCollection to)
{
ToolStripItem[] arr = new ToolStripItem[from.Count];
from.CopyTo(arr, 0);
to.AddRange(arr);
}