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


C# ToolStripItemCollection.IndexOfKey方法代码示例

本文整理汇总了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;
        }
开发者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


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