当前位置: 首页>>代码示例>>C#>>正文


C# ToolStripItemCollection.CopyTo方法代码示例

本文整理汇总了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;
        }
开发者ID:slavkur,项目名称:WarehouseApp,代码行数:45,代码来源:MainWindow.cs

示例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;
        }
开发者ID:slavkur,项目名称:WarehouseApp,代码行数:20,代码来源:MainWindow.cs

示例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;
            }
开发者ID:slavkur,项目名称:WarehouseApp,代码行数:47,代码来源:MainWindow.cs

示例4: MoveToolStripItems

 private static void MoveToolStripItems(ToolStripItemCollection from, ToolStripItemCollection to)
 {
     ToolStripItem[] arr = new ToolStripItem[from.Count];
     from.CopyTo(arr, 0);
     to.AddRange(arr);
 }
开发者ID:liddictm,项目名称:BrawlManagers,代码行数:6,代码来源:MainForm.cs


注:本文中的System.Windows.Forms.ToolStripItemCollection.CopyTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。