예제 #1
0
        private void toolStripDropDownButton1_DropDownOpening(object sender, EventArgs e)
        {
            var names         = RegistryUtility.ListKeys("WordWrapOptions\\").OrderBy().ToArray();
            var toolStripItem = (ToolStripDropDownButton)sender;

            toolStripItem.DropDownItems.Clear();
            var items = names.Select((n) =>
            {
                var item    = new ToolStripMenuItem(n);
                item.Tag    = n;
                item.Click += new EventHandler(item_Click);
                return(item);
            }).ToArray();

            toolStripItem.DropDownItems.AddRange(items);
        }
        private void importToolStripButton_DropDownOpening(object sender, EventArgs e)
        {
            foreach (ToolStripItem dropDownItem in importToolStripButton.DropDownItems)
            {
                dropDownItem.Click -= new EventHandler(newItem_Click);
            }

            importToolStripButton.DropDownItems.Clear();
            string[] keys = RegistryUtility.ListKeys("AnnotationSettings");
            foreach (var key in keys)
            {
                var newItem = new ToolStripMenuItem(key);
                newItem.Tag    = key;
                newItem.Click += new EventHandler(newItem_Click);
                importToolStripButton.DropDownItems.Add(newItem);
            }
        }