public virtual void OnPropertyGridPopupContextMenu(object sender, EventArgs e) { if (CurrentGrid.SelectedObject == null) { return; } MenuItem menuItemSeparator = new IconMenuItem("-"); MenuItem menuItem1 = new IconMenuItem("Add &New", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp"))); MenuItem menuItem3 = new IconMenuItem("&Delete", new Bitmap(WixFiles.GetResourceStream("bmp.delete.bmp"))); MenuItem menuItem4 = new IconMenuItem("&Rename"); MenuItem menuItem5 = new IconMenuItem("&Import XML", new Bitmap(WixFiles.GetResourceStream("bmp.import.bmp"))); menuItem1.Click += new EventHandler(OnNewPropertyGridItem); menuItem3.Click += new EventHandler(OnDeletePropertyGridItem); menuItem4.Click += new EventHandler(OnRenamePropertyGridItem); menuItem5.Click += new EventHandler(OnImportPropertyGridItem); CurrentGridContextMenu.MenuItems.Clear(); CurrentGridContextMenu.MenuItems.Add(menuItem1); if (CurrentGrid.SelectedGridItem.PropertyDescriptor != null) { CurrentGridContextMenu.MenuItems.Add(menuItem3); CurrentGridContextMenu.MenuItems.Add(menuItem4); } CurrentGridContextMenu.MenuItems.Add(menuItem5); }
/// <summary> /// Recursive add method to handle nesting of menu items. /// </summary> /// <param name="parent"></param> /// <param name="mi"></param> private void AddMenuItem(System.Windows.Forms.Menu.MenuItemCollection parent, SymbologyMenuItem mi) { MenuItem m; //if (mi.Icon != null) //{ // m = new IconMenuItem(mi.Name, mi.Icon, mi.ClickHandler); //} //else if (mi.Image != null) //{ // m = new IconMenuItem(mi.Name, mi.Image, mi.ClickHandler); //} //else //{ // m = new IconMenuItem(mi.Name, mi.ClickHandler); //} m = new IconMenuItem(mi.Name, mi.ClickHandler); parent.Add(m); foreach (SymbologyMenuItem child in mi.MenuItems) { AddMenuItem(m.MenuItems, child); } }
public override object Add(SimpleActionItem item) { var menu = new IconMenuItem(item.Caption, item.SmallImage, (sender, e) => item.OnClick(e)) { Name = item.Key, Enabled = item.Enabled, Visible = item.Visible, }; item.PropertyChanged += SimpleActionItemPropertyChanged; EnsureNonNullRoot(item); MenuItem root; if (item.MenuContainerKey == null) { root = !_mainmenu.MenuItems.ContainsKey(item.RootKey) ? _mainmenu.MenuItems[_mainmenu.MenuItems.Add(new MenuItem(item.RootKey) { Name = item.RootKey })] : _mainmenu.MenuItems.Find(item.RootKey, true)[0]; } else { root = _mainmenu.MenuItems.Find(item.MenuContainerKey, true)[0]; } root.MenuItems.Add(menu); return(menu); }
public override void OnPropertyGridPopupContextMenu(object sender, EventArgs e) { base.OnPropertyGridPopupContextMenu(sender, e); MenuItem menuItem2 = new IconMenuItem("Add &File", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp"))); menuItem2.Click += new EventHandler(OnAddFilePropertyGridItem); CurrentGridContextMenu.MenuItems.Add(1, menuItem2); }
public void Be_Creatable(IconChar icon) { var menuItem = new IconMenuItem { IconChar = icon }; menuItem.Should().NotBeNull(); menuItem.IconChar.Should().Be(icon); }
public IconMenuItem AddSeparator() { IconMenuItem item = new IconMenuItem() { Kind = IconMenuItemKind.Separator }; MenuItems.Add(item); return(item); }
/// <summary> /// Runs when the user displays the context menu for an item in /// the tree control on the Features panel. /// /// Adds the "Add components" menu item if the selected node is /// a feature /// </summary> /// <param name="node">The selected node</param> /// <param name="currTreeViewContextMenu">The context menu to extend</param> protected override void AddCustomTreeViewContextMenuItems(XmlNode node, ContextMenu currTreeViewContextMenu) { if (node.Name == "Feature") { IconMenuItem item = new IconMenuItem("Select Components to add"); item.Click += new EventHandler(mnuAddComponents_Click); currTreeViewContextMenu.MenuItems.Add(2, new IconMenuItem("-")); // "separator" currTreeViewContextMenu.MenuItems.Add(3, item); } }
protected override void PopupPanelContextMenu(System.Object sender, System.EventArgs e) { // clear menu and add import menu base.PopupPanelContextMenu(sender, e); // add custom menu, index has to be used!!! IconMenuItem subMenuItem = new IconMenuItem("New Feature", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp"))); subMenuItem.Click += new EventHandler(NewCustomElement_Click); PanelContextMenu.MenuItems.Add(0, subMenuItem); }
public IconMenuItem AddSeparator(string title) { IconMenuItem item = new IconMenuItem() { Kind = IconMenuItemKind.Caption, Text = title }; MenuItems.Add(item); return(item); }
private void MenuView_ItemTapped(object sender, ItemTappedEventArgs e) { IconMenuItem item = (IconMenuItem)e.Item; if ((item == null) || (item.Kind == IconMenuItemKind.Separator)) { return; } item?.Command(item.UserData); OnMenuTap?.Invoke(sender, e); }
public SearchPanel(EditorForm editorForm, IconMenuItem editMenu) { this.editorForm = editorForm; this.editMenu = editMenu; cancelMenuItem = new IconMenuItem(); cancelMenuItem.Text = "Cancel Find"; cancelMenuItem.Click += new EventHandler(cancelMenuItem_Click); cancelMenuItem.Shortcut = Shortcut.CtrlC; cancelMenuItem.ShowShortcut = true; InitializeComponent(); }
protected virtual void PopupPanelContextMenu(System.Object sender, System.EventArgs e) { //clear menu panelContextMenu.MenuItems.Clear(); //add import menu IconMenuItem itemImport = new IconMenuItem("&Import XML", new Bitmap(WixFiles.GetResourceStream("bmp.import.bmp"))); itemImport.Click += new System.EventHandler(ImportElement_Click); panelContextMenu.MenuItems.Add(new IconMenuItem("-")); panelContextMenu.MenuItems.Add(itemImport); }
public override void OnPropertyGridPopupContextMenu(object sender, EventArgs e) { if (CurrentGrid.SelectedObject == null) { return; } base.OnPropertyGridPopupContextMenu(sender, e); if (CurrentGrid.SelectedGridItem.PropertyDescriptor != null) { XmlNode selectedElement = GetSelectedGridObject(); XmlNodeList selectedSubElements = selectedElement.SelectNodes("*", WixFiles.WxsNsmgr); MenuItem menuItemSeparator1 = new IconMenuItem("-"); CurrentGridContextMenu.MenuItems.Add(1, menuItemSeparator1); if (selectedSubElements.Count == 0) { MenuItem subMenuItem = new IconMenuItem("Insert", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp"))); CurrentGridContextMenu.MenuItems.Add(1, subMenuItem); XmlNode definition = WixFiles.GetXsdElementNode("Property"); XmlNodeList subElements = definition.SelectNodes("xs:complexType/xs:sequence/xs:element", WixFiles.XsdNsmgr); foreach (XmlNode sub in subElements) { string subName = sub.Attributes["ref"].Value; MenuItem subSubMenuItem = new IconMenuItem(subName); subSubMenuItem.Click += new EventHandler(OnNewSubPropertyGridItem); subMenuItem.MenuItems.Add(subSubMenuItem); } } else if (selectedSubElements.Count == 1) { MenuItem subMenuItem = new IconMenuItem("Remove " + selectedSubElements[0].Name, new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp"))); CurrentGridContextMenu.MenuItems.Add(1, subMenuItem); subMenuItem.Click += new EventHandler(OnRemoveSubPropertyGridItem); } else { MenuItem subMenuItem = new IconMenuItem("Multiple subitems in property are unsupported!", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp"))); subMenuItem.Enabled = false; CurrentGridContextMenu.MenuItems.Add(1, subMenuItem); } MenuItem menuItemSeparator2 = new IconMenuItem("-"); CurrentGridContextMenu.MenuItems.Add(1, menuItemSeparator2); } }
protected override void AddCustomTreeViewContextMenuItems(XmlNode node, ContextMenu treeViewContextMenu) { if (node.Name == "Component") { IconMenuItem importFilesMenu = new IconMenuItem("&Import Files", new Bitmap(WixFiles.GetResourceStream("bmp.import.bmp"))); importFilesMenu.Click += new System.EventHandler(ImportFiles_Click); treeViewContextMenu.MenuItems.Add(1, importFilesMenu); } else if (node.Name == "Directory") { IconMenuItem importFolderMenu = new IconMenuItem("&Import Folder", new Bitmap(WixFiles.GetResourceStream("bmp.import.bmp"))); importFolderMenu.Click += new System.EventHandler(ImportFolder_Click); treeViewContextMenu.MenuItems.Add(1, importFolderMenu); } }
public IconMenuItem AddMenuItem(string title, string comment, string icon, Action <object> command, object userData) { IconMenuItem item = new IconMenuItem() { Kind = IconMenuItemKind.Command, Text = title, Comment = comment, Icon = icon, Command = command, UserData = userData }; MenuItems.Add(item); return(item); }
protected override MenuList OnGetMenuItems() { // intentionally dont inherit MenuList list = new MenuList(); list.SetContainerTitle(MenuListContainer.CustomOne, Catalog.GetString("Restore Files")); FileEnumerator enumerator = OwnedFile.EnumerateChildren("standard::type,standard::name", FileQueryInfoFlags.NofollowSymlinks, null); List <File> files = new List <File> (); if (enumerator != null) { FileInfo info; while ((info = enumerator.NextFile()) != null) { files.Add(OwnedFile.GetChild(info.Name)); info.Dispose(); } if (info != null) { info.Dispose(); } enumerator.Close(null); enumerator.Dispose(); } /* FIXME * - this code should work, but GetFiles() currently uses .net IO instead of GIO * when this starts working, the enumeration block above can go away too * foreach (File _f in OwnedFile.GetFiles ().OrderByDescending (f => f.QueryInfo<string> ("trash::deletion-date")).Take (5)) { */ foreach (File _f in files.OrderByDescending(f => f.QueryInfo <string> ("trash::deletion-date")).Take(5)) { File f = _f; MenuItem item = new IconMenuItem(f.Basename, f.Icon(), (o, a) => RestoreFile(f)); item.Mnemonic = null; list[MenuListContainer.CustomOne].Add(item); } list[MenuListContainer.CustomTwo].Add( new MenuItem(Catalog.GetString("_Open Trash"), Icon, (o, a) => OpenTrash())); list[MenuListContainer.CustomTwo].Add( new MenuItem(Catalog.GetString("Empty _Trash"), "gtk-clear", (o, a) => EmptyTrash(), !TrashFull)); return(list); }
private async void ResetChildren() { if (FlowPanel.Controls.Count > 0) { FlowPanel.Controls.Clear(); } listMenuCollection.DropDownItems.Clear(); NewListBox.TextBox.PlaceholderText = "New list name"; NewListBox.TextBox.Width = listMenuCollection.DropDown.Width; NewListBox.Width = listMenuCollection.DropDown.Width; listMenuCollection.DropDownItems.Add(NewListBox); var listCollection = await dataAccess.GetLists(); if (listCollection.Count == 1) { DeleteList.Enabled = false; DeleteList.Visible = false; } else { DeleteList.Enabled = true; DeleteList.Visible = true; } foreach (var list in listCollection) { var newItem = new IconMenuItem() { Text = list.Name, IconChar = list.ID == Config.SelectedListID ? IconChar.Check : IconChar.ExchangeAlt, Checked = list.ID == Config.SelectedListID, IconColor = list.ID == Config.SelectedListID ? Color.Green : Color.LightBlue }; listMenuCollection.DropDownItems.Add(newItem); } foreach (var item in await dataAccess.GetCurrentListItems()) { if (!item.Completed || Config.ShowCompleted) { FlowPanel.Controls.Add(new ToDoControl(item, ref dataAccess)); } } }
//I am not sure if we should impelement Import function in this panel. //if yes it should be implemented either new function. protected override void PopupPanelContextMenu(System.Object sender, System.EventArgs e) { //clear menu and add import menu base.PopupPanelContextMenu(sender, e); if (currTreeView.Nodes.Count == 0) { //add custom menu, index has to be used!!! IconMenuItem subMenuItem = new IconMenuItem("New", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp"))); IconMenuItem subSubMenuItem1 = new IconMenuItem("Product"); IconMenuItem subSubMenuItem2 = new IconMenuItem("Module"); subSubMenuItem1.Click += new EventHandler(NewCustomElement_Click); subSubMenuItem2.Click += new EventHandler(NewCustomElement_Click); subMenuItem.MenuItems.Add(subSubMenuItem1); subMenuItem.MenuItems.Add(subSubMenuItem2); PanelContextMenu.MenuItems.Add(0, subMenuItem); } }
protected override void PopupPanelContextMenu(System.Object sender, System.EventArgs e) { //clear menu and add import menu base.PopupPanelContextMenu(sender, e); //add custom menu, index has to be used!!! IconMenuItem subMenuItem = new IconMenuItem("New", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp"))); MenuItem subSubMenuItem1 = new MenuItem("InstallExecuteSequence"); MenuItem subSubMenuItem2 = new MenuItem("AdminExecuteSequence"); MenuItem subSubMenuItem3 = new MenuItem("AdvertiseExecuteSequence"); subSubMenuItem1.Click += new EventHandler(NewCustomElement_Click); subSubMenuItem2.Click += new EventHandler(NewCustomElement_Click); subSubMenuItem3.Click += new EventHandler(NewCustomElement_Click); subMenuItem.MenuItems.Add(subSubMenuItem1); subMenuItem.MenuItems.Add(subSubMenuItem2); subMenuItem.MenuItems.Add(subSubMenuItem3); PanelContextMenu.MenuItems.Add(0, subMenuItem); }
public OutputPanel(EditorForm editorForm, IconMenuItem buildMenu) { this.editorForm = editorForm; this.buildMenu = buildMenu; TabStop = true; outputTextBox = new OutputTextbox(); outputTextBox.Dock = DockStyle.Fill; outputTextBox.ScrollBars = RichTextBoxScrollBars.Both; outputTextBox.WordWrap = WixEditSettings.Instance.WordWrapInResultsPanel; outputTextBox.AllowDrop = false; Controls.Add(outputTextBox); outputTextBox.TabStop = true; outputTextBox.HideSelection = false; outputTextBox.MouseUp += new MouseEventHandler(outputTextBox_MouseDown); doubleClickTimer.Interval = 100; doubleClickTimer.Tick += new EventHandler(doubleClickTimer_Tick); cancelMenuItem = new IconMenuItem(); cancelMenuItem.Text = "Cancel Action"; cancelMenuItem.Click += new EventHandler(cancelMenuItem_Click); cancelMenuItem.Shortcut = Shortcut.CtrlC; cancelMenuItem.ShowShortcut = true; invokeClearRTF = new DelegateClearRtf(ClearRtf); invokeOutput = new DelegateOutput(Output); invokeOutputLine = new DelegateOutputLine(OutputLine); invokeOutputStart = new DelegateOutputStart(OutputStart); invokeOutputDone = new DelegateOutputDone(OutputDone); invokeProcessDone = new DelegateProcessDone(ProcessDone); }
public void AddMenuItem(IconMenuItem item) { MenuItems.Add(item); }
public void OnPropertyGridPopupContextMenu(object sender, EventArgs e) { elementPropertyGridContextMenu.MenuItems.Clear(); if (elementPropertyGrid.SelectedObject == null) { return; } XmlAttributeAdapter attAdapter = (XmlAttributeAdapter)elementPropertyGrid.SelectedObject; if (attAdapter.XmlNodeDefinition == null) { // Don't know, but can not show the context menu. return; } // Need to change "Delete" to "Clear" for required items. bool isRequired = false; // Get the XmlAttribute from the PropertyDescriptor XmlAttributePropertyDescriptor desc = elementPropertyGrid.SelectedGridItem.PropertyDescriptor as XmlAttributePropertyDescriptor; if (desc != null) { XmlAttribute att = desc.Attribute; XmlNode xmlAttributeDefinition = attAdapter.XmlNodeDefinition.SelectSingleNode(String.Format("xs:attribute[@name='{0}']", att.Name), wixFiles.XsdNsmgr); if (xmlAttributeDefinition.Attributes["use"] != null && xmlAttributeDefinition.Attributes["use"].Value == "required") { isRequired = true; } } MenuItem menuItemSeparator = new IconMenuItem("-"); // See if new menu item should be shown. bool canCreateNew = false; XmlNodeList xmlAttributes = attAdapter.XmlNodeDefinition.SelectNodes("xs:attribute", wixFiles.XsdNsmgr); foreach (XmlNode at in xmlAttributes) { string attName = at.Attributes["name"].Value; if (attAdapter.XmlNode.Attributes[attName] == null) { canCreateNew = true; } } if (canCreateNew) { // Define the MenuItem objects to display for the TextBox. MenuItem menuItem1 = new IconMenuItem("&New", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp"))); menuItem1.Click += new EventHandler(OnNewPropertyGridItem); elementPropertyGridContextMenu.MenuItems.Add(menuItem1); } // Add the clear or delete menu item MenuItem menuItem2 = null; if (elementPropertyGrid.SelectedGridItem.PropertyDescriptor != null && !(elementPropertyGrid.SelectedGridItem.PropertyDescriptor is InnerTextPropertyDescriptor)) { if (isRequired) { menuItem2 = new IconMenuItem("&Clear", new Bitmap(WixFiles.GetResourceStream("bmp.clear.bmp"))); } else { menuItem2 = new IconMenuItem("&Delete", new Bitmap(WixFiles.GetResourceStream("bmp.delete.bmp"))); } menuItem2.Click += new EventHandler(OnDeletePropertyGridItem); elementPropertyGridContextMenu.MenuItems.Add(menuItem2); } if (elementPropertyGridContextMenu.MenuItems.Count > 0) { elementPropertyGridContextMenu.MenuItems.Add(menuItemSeparator); } MenuItem menuItem3 = new IconMenuItem("Description"); menuItem3.Click += new EventHandler(OnToggleDescriptionPropertyGrid); menuItem3.Checked = elementPropertyGrid.HelpVisible; elementPropertyGridContextMenu.MenuItems.Add(menuItem3); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmShellLinkTester)); this.mnuMain = new IconMainMenu(); this.mnuFileTop = new IconMenuItem(); this.mnuNew = new IconMenuItem(); this.mnuOpen = new IconMenuItem(); this.mnuClose = new IconMenuItem(); this.mnuFileSep1 = new IconMenuItem(); this.mnuSave = new IconMenuItem(); this.mnuSaveAs = new IconMenuItem(); this.mnuFileSep2 = new IconMenuItem(); this.mnuExit = new IconMenuItem(); this.mnuHelpTop = new IconMenuItem(); this.mnuAbout = new IconMenuItem(); this.lblShortCut = new System.Windows.Forms.Label(); this.lblTarget = new System.Windows.Forms.Label(); this.txtTarget = new vbAccelerator.Controls.TextBox.AutoCompleteTextBox(); this.txtArguments = new System.Windows.Forms.TextBox(); this.txtDescription = new System.Windows.Forms.TextBox(); this.lblArguments = new System.Windows.Forms.Label(); this.lblDescription = new System.Windows.Forms.Label(); this.btnPick = new System.Windows.Forms.Button(); this.fraIcon = new System.Windows.Forms.GroupBox(); this.btnChooseIcon = new System.Windows.Forms.Button(); this.picIcon = new System.Windows.Forms.PictureBox(); this.picSmallIcon = new System.Windows.Forms.PictureBox(); this.txtIconIndex = new System.Windows.Forms.TextBox(); this.txtIconFile = new System.Windows.Forms.TextBox(); this.lblIconIndex = new System.Windows.Forms.Label(); this.lblIconFile = new System.Windows.Forms.Label(); this.fraIcon.SuspendLayout(); this.SuspendLayout(); // // mnuMain // this.mnuMain.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.mnuFileTop, this.mnuHelpTop }); // // mnuFileTop // this.mnuFileTop.Index = 0; this.mnuFileTop.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.mnuNew, this.mnuOpen, this.mnuClose, this.mnuFileSep1, this.mnuSave, this.mnuSaveAs, this.mnuFileSep2, this.mnuExit }); this.mnuFileTop.Text = "&File"; // // mnuNew // this.mnuNew.Index = 0; this.mnuNew.Shortcut = System.Windows.Forms.Shortcut.CtrlN; this.mnuNew.Text = "&New"; // // mnuOpen // this.mnuOpen.Index = 1; this.mnuOpen.Shortcut = System.Windows.Forms.Shortcut.CtrlO; this.mnuOpen.Text = "&Open..."; // // mnuClose // this.mnuClose.Index = 2; this.mnuClose.Text = "&Close"; // // mnuFileSep1 // this.mnuFileSep1.Index = 3; this.mnuFileSep1.Text = "-"; // // mnuSave // this.mnuSave.Index = 4; this.mnuSave.Shortcut = System.Windows.Forms.Shortcut.CtrlS; this.mnuSave.Text = "&Save"; // // mnuSaveAs // this.mnuSaveAs.Index = 5; this.mnuSaveAs.Text = "Save &As..."; // // mnuFileSep2 // this.mnuFileSep2.Index = 6; this.mnuFileSep2.Text = "-"; // // mnuExit // this.mnuExit.Index = 7; this.mnuExit.Text = "E&xit"; // // mnuHelpTop // this.mnuHelpTop.Index = 1; this.mnuHelpTop.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.mnuAbout }); this.mnuHelpTop.Text = "&Help"; // // mnuAbout // this.mnuAbout.Index = 0; this.mnuAbout.Text = "&About..."; // // lblShortCut // this.lblShortCut.BackColor = System.Drawing.SystemColors.ControlDark; this.lblShortCut.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.lblShortCut.ForeColor = System.Drawing.SystemColors.ControlLight; this.lblShortCut.Location = new System.Drawing.Point(4, 4); this.lblShortCut.Name = "lblShortCut"; this.lblShortCut.Size = new System.Drawing.Size(372, 24); this.lblShortCut.TabIndex = 0; this.lblShortCut.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // lblTarget // this.lblTarget.Location = new System.Drawing.Point(4, 40); this.lblTarget.Name = "lblTarget"; this.lblTarget.Size = new System.Drawing.Size(68, 20); this.lblTarget.TabIndex = 1; this.lblTarget.Text = "&Target:"; // // txtTarget // this.txtTarget.AutoCompleteFlags = vbAccelerator.Controls.TextBox.AutoCompleteTextBox.SHAutoCompleteFlags.SHACF_FILESYS_ONLY; this.txtTarget.Location = new System.Drawing.Point(72, 36); this.txtTarget.Name = "txtTarget"; this.txtTarget.Size = new System.Drawing.Size(280, 21); this.txtTarget.TabIndex = 2; this.txtTarget.Text = ""; // // txtArguments // this.txtArguments.Location = new System.Drawing.Point(72, 60); this.txtArguments.Name = "txtArguments"; this.txtArguments.Size = new System.Drawing.Size(280, 21); this.txtArguments.TabIndex = 3; this.txtArguments.Text = ""; // // txtDescription // this.txtDescription.Location = new System.Drawing.Point(72, 112); this.txtDescription.MaxLength = 1024; this.txtDescription.Multiline = true; this.txtDescription.Name = "txtDescription"; this.txtDescription.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.txtDescription.Size = new System.Drawing.Size(280, 80); this.txtDescription.TabIndex = 4; this.txtDescription.Text = ""; // // lblArguments // this.lblArguments.Location = new System.Drawing.Point(4, 64); this.lblArguments.Name = "lblArguments"; this.lblArguments.Size = new System.Drawing.Size(68, 23); this.lblArguments.TabIndex = 9; this.lblArguments.Text = "Arguments:"; // // lblDescription // this.lblDescription.Location = new System.Drawing.Point(4, 112); this.lblDescription.Name = "lblDescription"; this.lblDescription.Size = new System.Drawing.Size(68, 23); this.lblDescription.TabIndex = 10; this.lblDescription.Text = "Description:"; // // btnPick // this.btnPick.FlatStyle = System.Windows.Forms.FlatStyle.System; this.btnPick.Location = new System.Drawing.Point(356, 36); this.btnPick.Name = "btnPick"; this.btnPick.Size = new System.Drawing.Size(20, 20); this.btnPick.TabIndex = 13; this.btnPick.Text = "..."; this.btnPick.Click += new System.EventHandler(this.btnPick_Click); // // fraIcon // this.fraIcon.Anchor = System.Windows.Forms.AnchorStyles.None; this.fraIcon.Controls.AddRange(new System.Windows.Forms.Control[] { this.btnChooseIcon, this.picIcon, this.picSmallIcon, this.txtIconIndex, this.txtIconFile, this.lblIconIndex, this.lblIconFile }); this.fraIcon.FlatStyle = System.Windows.Forms.FlatStyle.System; this.fraIcon.Location = new System.Drawing.Point(8, 200); this.fraIcon.Name = "fraIcon"; this.fraIcon.Size = new System.Drawing.Size(344, 156); this.fraIcon.TabIndex = 14; this.fraIcon.TabStop = false; this.fraIcon.Text = "Icon:"; // // btnChooseIcon // this.btnChooseIcon.FlatStyle = System.Windows.Forms.FlatStyle.System; this.btnChooseIcon.Location = new System.Drawing.Point(64, 116); this.btnChooseIcon.Name = "btnChooseIcon"; this.btnChooseIcon.Size = new System.Drawing.Size(76, 32); this.btnChooseIcon.TabIndex = 19; this.btnChooseIcon.Text = "Pick..."; this.btnChooseIcon.Click += new System.EventHandler(this.btnChooseIcon_Click); // // picIcon // this.picIcon.Location = new System.Drawing.Point(68, 80); this.picIcon.Name = "picIcon"; this.picIcon.Size = new System.Drawing.Size(32, 32); this.picIcon.TabIndex = 18; this.picIcon.TabStop = false; // // picSmallIcon // this.picSmallIcon.Location = new System.Drawing.Point(104, 80); this.picSmallIcon.Name = "picSmallIcon"; this.picSmallIcon.Size = new System.Drawing.Size(32, 32); this.picSmallIcon.TabIndex = 17; this.picSmallIcon.TabStop = false; // // txtIconIndex // this.txtIconIndex.BackColor = System.Drawing.SystemColors.Control; this.txtIconIndex.Location = new System.Drawing.Point(64, 52); this.txtIconIndex.Name = "txtIconIndex"; this.txtIconIndex.ReadOnly = true; this.txtIconIndex.Size = new System.Drawing.Size(276, 21); this.txtIconIndex.TabIndex = 16; this.txtIconIndex.Text = ""; // // txtIconFile // this.txtIconFile.BackColor = System.Drawing.SystemColors.Control; this.txtIconFile.Location = new System.Drawing.Point(64, 24); this.txtIconFile.Name = "txtIconFile"; this.txtIconFile.ReadOnly = true; this.txtIconFile.Size = new System.Drawing.Size(276, 21); this.txtIconFile.TabIndex = 15; this.txtIconFile.Text = ""; // // lblIconIndex // this.lblIconIndex.Location = new System.Drawing.Point(4, 52); this.lblIconIndex.Name = "lblIconIndex"; this.lblIconIndex.TabIndex = 14; this.lblIconIndex.Text = "Icon Index:"; // // lblIconFile // this.lblIconFile.Location = new System.Drawing.Point(4, 24); this.lblIconFile.Name = "lblIconFile"; this.lblIconFile.Size = new System.Drawing.Size(60, 23); this.lblIconFile.TabIndex = 13; this.lblIconFile.Text = "Icon File:"; // // frmShellLinkTester // this.AutoScaleBaseSize = new System.Drawing.Size(5, 14); this.ClientSize = new System.Drawing.Size(380, 365); this.Controls.AddRange(new System.Windows.Forms.Control[] { this.fraIcon, this.btnPick, this.lblDescription, this.lblArguments, this.txtDescription, this.txtArguments, this.txtTarget, this.lblTarget, this.lblShortCut }); this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Menu = this.mnuMain; this.Name = "frmShellLinkTester"; this.Text = "Shell Link Tester"; this.Load += new System.EventHandler(this.frmShellLinkTester_Load); this.fraIcon.ResumeLayout(false); this.ResumeLayout(false); }
/// Initialize Component private void InitializeItems() { //Initialize the components for the form design: add the title bar, buttons for maximized, minimized, //form options dropdown menu and the client area of the form*/ components = new System.ComponentModel.Container();//initialize container #region -Control Instantiation pnlClientArea = new Panel(); pnlTitleBar = new Panel(); lblCaption = new Label(); dragControl = new CTDragControl(pnlTitleBar, this, components); //Drag control, add to component container dmFormOptions = new CTDropdownMenu(components); //Add to component container btnFormIcon = new FontAwesome.Sharp.IconButton(); miHelp = new FontAwesome.Sharp.IconMenuItem(); pnlTitleBar.SuspendLayout(); #endregion #region -Form Title Bar // // Panel: Form Title Bar // pnlTitleBar.Name = "pnlTitleBar"; pnlTitleBar.Location = new Point(0, 0); pnlTitleBar.Dock = DockStyle.Top; pnlTitleBar.Size = new Size(960, 40); pnlTitleBar.Controls.Add(btnFormIcon);//Add controls pnlTitleBar.Controls.Add(lblCaption); pnlTitleBar.Controls.Add(this.btnMinimize); pnlTitleBar.Controls.Add(this.btnMaximize); pnlTitleBar.Controls.Add(this.btnClose); // // Icon Button: Form Icon (FontAwesome.Sharp library) // btnFormIcon.Name = "btnIcon"; btnFormIcon.Cursor = Cursors.Hand; btnFormIcon.FlatStyle = FlatStyle.Flat; btnFormIcon.FlatAppearance.BorderSize = 0; btnFormIcon.Flip = FontAwesome.Sharp.FlipOrientation.Normal; btnFormIcon.IconChar = FontAwesome.Sharp.IconChar.Folder; btnFormIcon.IconColor = Color.WhiteSmoke; btnFormIcon.IconSize = 25; btnFormIcon.Rotation = 0D; btnFormIcon.Location = new Point(0, 0); btnFormIcon.Size = new Size(40, 40); btnFormIcon.UseVisualStyleBackColor = false;//Events btnFormIcon.MouseEnter += new System.EventHandler(FormIcon_MouseEnter); btnFormIcon.MouseLeave += new System.EventHandler(FormIcon_MouseLeave); btnFormIcon.Click += new System.EventHandler(FormIcon_Click); FormIcon = IconChar.Folder; // // Label: Form Caption // lblCaption.Name = "lblCaption"; lblCaption.AutoSize = true; lblCaption.Font = new Font("Montserrat", 10F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); lblCaption.ForeColor = Color.WhiteSmoke; lblCaption.Location = new Point(40, 10); // // Button: Control box buttons // this.btnClose.Dock = DockStyle.Right; this.btnMaximize.Dock = DockStyle.Right; this.btnMinimize.Dock = DockStyle.Right; #endregion #region -Form Options // // Icon MenuItem: Help (FontAwesome.Sharp library) // miHelp.Name = "miHelp"; miHelp.Text = "Help"; miHelp.IconSize = 21; miHelp.IconChar = IconChar.Question; miHelp.IconColor = Colors.FantasyColorScheme4; miHelp.Click += new System.EventHandler(HelpMessage_Click); // // DropdownMenu: Form Options // dmFormOptions.Name = "dmFormOptions"; dmFormOptions.Font = new Font("Microsoft Sans Serif", 10F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); dmFormOptions.Items.AddRange(new ToolStripItem[] { //Add menu items miSnapLeft, //Snap Window Left miSnapRight, //Snap Window Right miExitSnap, //Exit Snap Window miHelp }); dmFormOptions.OwnerIsMenuButton = false; dmFormOptions.VisibleChanged += new EventHandler(FormOptions_VisibleChanged); #endregion #region -Client Area // Panel: Client Area (Form Body) pnlClientArea.Dock = DockStyle.Fill; pnlClientArea.Location = new Point(0, 40); pnlClientArea.Name = "pnlClientArea"; pnlClientArea.Size = new Size(960, 485); pnlClientArea.AutoScroll = true; #endregion #region -RJ Child Form Properties // // RJChildForm // this.Name = "RJChildForm"; this.Text = "RJ Child form"; this.Controls.Add(pnlClientArea); this.Controls.Add(pnlTitleBar); this.AutoScaleDimensions = new SizeF(6F, 13F); this.AutoScaleMode = AutoScaleMode.None; //Disable autoscale mode, to keep the form size set in the DefaultSize property this.FormBorderStyle = FormBorderStyle.None; //Borderless form this.MinimumSize = new Size(400, 180); //Minimun form size this.DoubleBuffered = true; this.Resize += new System.EventHandler(Form_Resize); this.Deactivate += new EventHandler(Form_Deactivated); //subscribe Deactivate event to change / opaque title bar color this.Activated += new EventHandler(Form_Activated); //Subscribe Activated event to retrieve title bar color desktopPanelSize = true; //Set default value pnlTitleBar.PerformLayout(); pnlTitleBar.ResumeLayout(); #endregion }
/// Initialize Component private void InitializeItems() { /// Initialize the components (object instantiation) for the form design: /// add the title bar, side menu, buttons for maximized, minimized, form options-user options dropdown menu /// and the client area(Desktop) of the form /// components = new System.ComponentModel.Container();//initialize container #region -Control Instantiation pnlSideMenu = new Panel(); pnlSideMenuHeader = new Panel(); pnlTitleBar = new Panel(); pnlDesktop = new Panel(); pnlDesktopHeader = new Panel(); pnlMarker = new Panel(); pnlSide = new Panel(); btnMoveNewWindow = new FontAwesome.Sharp.IconButton();///(FontAwesome.Sharp library) btnScreenshot = new FontAwesome.Sharp.IconButton(); btnPrint = new FontAwesome.Sharp.IconButton(); btnHelp = new FontAwesome.Sharp.IconButton(); biSideMenuButton = new CTMenuIcon(); biFormIcon = new CTMenuIcon(); lblCaption = new CTLabel(); dmFormOptions = new CTDropdownMenu(components); //Add to component container miCloseChildForms = new FontAwesome.Sharp.IconMenuItem(); ///(FontAwesome.Sharp library) toolTip = new ToolTip(components); //Add to component container dragControl = new CTDragControl(pnlTitleBar, this, components); ///Drag Control, add to component container //Suspend layout #endregion #region -Form Side Menu // // Panel: Side Panel // pnlSide.Name = "pnlSide"; pnlSide.Dock = DockStyle.Left; pnlSide.Location = new Point(0, 0); pnlSide.Size = new Size(220, 610); pnlSide.Controls.Add(pnlSideMenu); pnlSide.Controls.Add(pnlSideMenuHeader); // // Panel: Side Menu // pnlSideMenu.Name = "pnlSideMenu"; pnlSideMenu.Padding = new Padding(0, 65, 0, 0); pnlSideMenu.BackColor = Colors.SideMenuColor; pnlSideMenu.Dock = DockStyle.Fill; pnlSideMenu.Location = new Point(0, 60); pnlSideMenu.Size = new Size(220, 550); pnlSideMenu.Controls.Add(pnlMarker);//Add controls // // Panel: Side Menu Header // pnlSideMenuHeader.Name = "pnlSideMenuHeader"; pnlSideMenuHeader.Controls.Add(biSideMenuButton);//Add controls pnlSideMenuHeader.Size = new Size(220, 60); pnlSideMenuHeader.Dock = DockStyle.Top; pnlSideMenuHeader.Location = new Point(0, 0); // // RJ BarIcon: Side Menu Button // biSideMenuButton.Name = "biSideMenuButton"; biSideMenuButton.Anchor = (AnchorStyles.Top | AnchorStyles.Right); biSideMenuButton.Customizable = true; biSideMenuButton.IconColor = Color.White; biSideMenuButton.BackColor = Color.Transparent; biSideMenuButton.Cursor = Cursors.Hand; biSideMenuButton.IconChar = FontAwesome.Sharp.IconChar.Bars;///(FontAwesome.Sharp library) biSideMenuButton.IconSize = 25; biSideMenuButton.Location = new Point(175, 20); biSideMenuButton.Size = new System.Drawing.Size(25, 25); biSideMenuButton.Click += new System.EventHandler(SideMenuButton_Click);//Event // // Panel: Child Form Marker // pnlMarker.Name = "pnlChildFormMarker"; pnlMarker.Size = new Size(4, 55); pnlMarker.Location = new Point(0, 60); pnlMarker.Visible = false; #endregion #region -Form Title Bar // // Panel: TitleBar // pnlTitleBar.Name = "pnlTitleBar"; pnlTitleBar.BackColor = UIAppearance.StyleColor; pnlTitleBar.Size = new Size(960, 60); pnlTitleBar.Location = new Point(220, 0); pnlTitleBar.Dock = DockStyle.Top; pnlTitleBar.Controls.Add(lblCaption);//Add controls pnlTitleBar.Controls.Add(biFormIcon); pnlTitleBar.Controls.Add(this.btnMinimize); pnlTitleBar.Controls.Add(this.btnMaximize); pnlTitleBar.Controls.Add(this.btnClose); // // Label: Form Caption // lblCaption.Name = "lblCaption"; lblCaption.AutoSize = true; lblCaption.Style = LabelStyle.BarCaption; lblCaption.Location = new Point(46, 21); lblCaption.TextAlign = ContentAlignment.MiddleLeft; lblCaption.Text = "Home"; // // Button: Control box buttons // this.btnClose.Size = new Size(35, 20); this.btnClose.Anchor = (AnchorStyles.Top | AnchorStyles.Right); this.btnMaximize.Size = new Size(35, 20); this.btnMaximize.Anchor = (AnchorStyles.Top | AnchorStyles.Right); this.btnMinimize.Size = new Size(35, 20); this.btnMinimize.Anchor = (AnchorStyles.Top | AnchorStyles.Right); // // Bar Icon: Active Form Icon // biFormIcon.Name = "biFormIcon"; biFormIcon.BackColor = Color.Transparent; biFormIcon.Cursor = Cursors.Hand; biFormIcon.IconChar = FontAwesome.Sharp.IconChar.Home;///(FontAwesome.Sharp library) biFormIcon.IconSize = 25; biFormIcon.Location = new Point(19, 20); biFormIcon.Size = new Size(25, 25); biFormIcon.SizeMode = PictureBoxSizeMode.AutoSize; biFormIcon.Click += new System.EventHandler(this.FormIcon_Click);//Events biFormIcon.MouseEnter += new System.EventHandler(this.FormIcon_MouseHover); biFormIcon.MouseLeave += new System.EventHandler(this.FormIcon_MouseLeave); #endregion #region -Form Options // // Icon MenuItem: Close Child Forms (FontAwesome.Sharp library) // miCloseChildForms.Name = "miCloseChildForms"; miCloseChildForms.Text = "Close Child Forms"; miCloseChildForms.IconSize = 24; miCloseChildForms.IconChar = FontAwesome.Sharp.IconChar.CalendarTimes; miCloseChildForms.IconColor = Colors.FantasyColorScheme4; miCloseChildForms.Click += new System.EventHandler(CloseAllChildForms_Click);//Event // // DropdownMenu: Form Options ------------- // dmFormOptions.Name = "dmFormOptions"; dmFormOptions.Font = new Font("Microsoft Sans Serif", 10F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); dmFormOptions.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { miSnapLeft, //Snap Window Left miSnapRight, //Snap Window Right miExitSnap, //Exit Snap Window miCloseChildForms }); dmFormOptions.OwnerIsMenuButton = false; #endregion #region -Desktop Header (Child Form Options) // // Panel: Desktop Header ------------- // pnlDesktopHeader.Name = "pnlDesktopHeader"; pnlDesktopHeader.BackColor = Colors.LightBackground; pnlDesktopHeader.Dock = DockStyle.Top; pnlDesktopHeader.Location = new Point(220, 60); pnlDesktopHeader.Size = new Size(960, 25); pnlDesktopHeader.Padding = new Padding(14, 0, 0, 0); pnlDesktopHeader.Controls.Add(btnHelp);//Add controls pnlDesktopHeader.Controls.Add(btnMoveNewWindow); pnlDesktopHeader.Controls.Add(btnScreenshot); pnlDesktopHeader.Controls.Add(btnPrint); // // Icon Button: Print Form (FontAwesome.Sharp library) // btnPrint.Dock = DockStyle.Left; btnPrint.FlatAppearance.BorderSize = 0; btnPrint.FlatStyle = FlatStyle.Flat; btnPrint.IconSize = 20; btnPrint.IconChar = FontAwesome.Sharp.IconChar.Print; btnPrint.IconColor = Colors.FantasyColorScheme1; btnPrint.Location = new Point(0, 0); btnPrint.Name = "btnPrint"; btnPrint.Size = new Size(35, 25); btnPrint.UseVisualStyleBackColor = true; btnPrint.Cursor = Cursors.Hand; btnPrint.Visible = false; btnPrint.Click += new EventHandler(Print_Click); // // Icon Button: Form Screenshot (FontAwesome.Sharp library) // btnScreenshot.Dock = DockStyle.Left; btnScreenshot.FlatAppearance.BorderSize = 0; btnScreenshot.FlatStyle = FlatStyle.Flat; btnScreenshot.IconSize = 20; btnScreenshot.IconChar = FontAwesome.Sharp.IconChar.Camera; btnScreenshot.IconColor = Colors.FantasyColorScheme2; btnScreenshot.Location = new Point(0, 0); btnScreenshot.Name = "btnScreenShoot"; btnScreenshot.Size = new Size(35, 25); btnScreenshot.UseVisualStyleBackColor = true; btnScreenshot.Cursor = Cursors.Hand; btnScreenshot.Visible = false; btnScreenshot.Click += new EventHandler(Screenshot_Click); // // Icon Button: Move Child Form New Window (FontAwesome.Sharp library) // btnMoveNewWindow.Name = "btnOpenNewWindow"; btnMoveNewWindow.Dock = DockStyle.Left; btnMoveNewWindow.FlatAppearance.BorderSize = 0; btnMoveNewWindow.FlatStyle = FlatStyle.Flat; btnMoveNewWindow.IconSize = 20; btnMoveNewWindow.IconChar = FontAwesome.Sharp.IconChar.WindowMaximize; btnMoveNewWindow.IconColor = Colors.FantasyColorScheme3; btnMoveNewWindow.Location = new Point(15, 0); btnMoveNewWindow.Size = new Size(35, 25); btnMoveNewWindow.UseVisualStyleBackColor = true; btnMoveNewWindow.Cursor = Cursors.Hand; btnMoveNewWindow.Visible = false; btnMoveNewWindow.Click += new EventHandler(MoveNewWindow_Click);//Event // // Icon Button: User Help (FontAwesome.Sharp library) // btnHelp.Dock = DockStyle.Left; btnHelp.FlatAppearance.BorderSize = 0; btnHelp.FlatStyle = FlatStyle.Flat; btnHelp.IconSize = 20; btnHelp.IconChar = FontAwesome.Sharp.IconChar.QuestionCircle; btnHelp.IconColor = Colors.FantasyColorScheme4; btnHelp.Location = new Point(0, 0); btnHelp.Name = "btnHelp"; btnHelp.Size = new Size(35, 25); btnHelp.UseVisualStyleBackColor = true; btnHelp.Cursor = Cursors.Hand; btnHelp.Visible = false; btnHelp.Click += new EventHandler(ChilFormHelp_Click); #endregion #region -Desktop (Cliente area - Child form container) // // Panel: Desktop // pnlDesktop.Name = "pnlDesktop"; pnlDesktop.BackColor = Colors.LightBackground; pnlDesktop.Dock = DockStyle.Fill; pnlDesktop.Location = new Point(220, 85); pnlDesktop.Size = new Size(960, 525); #endregion #region -Others // // ToolTip // toolTip.AutoPopDelay = 5000; toolTip.InitialDelay = 1000; toolTip.ReshowDelay = 500; toolTip.ShowAlways = true; toolTip.BackColor = Color.FromArgb(236, 82, 99); toolTip.ForeColor = Color.White; toolTip.OwnerDraw = true; toolTip.Draw += new DrawToolTipEventHandler(ToolTip_Draw); toolTip.SetToolTip(btnPrint, "Print child form content"); toolTip.SetToolTip(btnScreenshot, "Take a screenshot"); toolTip.SetToolTip(btnMoveNewWindow, "Move child form to new window"); toolTip.SetToolTip(btnHelp, "Help message to user"); #endregion #region -RJ Main Form Properties // //RJMainForm // deactivateFormEvent = true; this.Resizable = true; this.PrimaryForm = true; this.AutoScaleDimensions = new SizeF(6F, 13F); this.AutoScaleMode = AutoScaleMode.None; this.FormBorderStyle = FormBorderStyle.None; //Borderless form this.MinimumSize = new Size(650, 400); //Minimun form size this.Controls.Add(pnlDesktop); //Add controls this.Controls.Add(pnlDesktopHeader); this.Controls.Add(pnlTitleBar); this.Controls.Add(pnlSide); this.Deactivate += new EventHandler(Form_Deactivated); //subscribe Deactivate event to change / opaque title bar color this.Activated += new EventHandler(Form_Activated); //Subscribe Activated event to retrieve title bar color #endregion }
public FileSheet(WizardForm creator) : base(creator) { this.AutoScroll = true; titleLabel = new Label(); titleLabel.Text = "Add files and folders to install."; titleLabel.Dock = DockStyle.Top; titleLabel.Height = 20; titleLabel.Left = 0; titleLabel.Top = 0; titleLabel.Padding = new Padding(5, 5, 5, 0); titleLabel.Font = new Font("Verdana", 10, FontStyle.Bold, GraphicsUnit.Point ); titleLabel.BackColor = Color.White; descriptionLabel = new Label(); descriptionLabel.Text = "Select Files and Directories you want to add to the installer"; descriptionLabel.Dock = DockStyle.Top; descriptionLabel.Height = 50 - titleLabel.Height; descriptionLabel.Left = 0; descriptionLabel.Top = titleLabel.Height; descriptionLabel.Padding = new Padding(8, 3, 5, 0); descriptionLabel.BackColor = Color.White; this.Controls.Add(descriptionLabel); this.Controls.Add(titleLabel); lineLabel = new Label(); lineLabel.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; lineLabel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; lineLabel.Location = new Point(0, titleLabel.Height + descriptionLabel.Height); lineLabel.Size = new Size(this.Width, 2); this.Controls.Add(lineLabel); tree = new TreeView(); tree.HideSelection = false; tree.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; tree.Location = new Point(4, titleLabel.Height + descriptionLabel.Height + lineLabel.Height + 5); tree.Width = this.Width - 8 - 100 - 8; tree.Height = this.Height - tree.Top - 7; tree.ImageList = ImageListFactory.GetImageList(); tree.MouseDown += new MouseEventHandler(tree_MouseDown); this.Controls.Add(tree); newFolderButton = new Button(); newFolderButton.Anchor = AnchorStyles.Top | AnchorStyles.Right; newFolderButton.Location = new Point(tree.Location.X + tree.Width + 8, tree.Top); newFolderButton.Width = 100; newFolderButton.Height = 23; newFolderButton.Text = "New folder"; newFolderButton.Click += new EventHandler(newFolderButton_Click); this.Controls.Add(newFolderButton); removeButton = new Button(); removeButton.Anchor = AnchorStyles.Top | AnchorStyles.Right; removeButton.Location = new Point(tree.Location.X + tree.Width + 8, newFolderButton.Bottom + 8); removeButton.Width = 100; removeButton.Height = 23; removeButton.Text = "Remove folder"; removeButton.Click += new EventHandler(removeButton_Click); this.Controls.Add(removeButton); importDirectoryButton = new Button(); importDirectoryButton.Anchor = AnchorStyles.Top | AnchorStyles.Right; importDirectoryButton.Location = new Point(tree.Location.X + tree.Width + 8, removeButton.Bottom + 8); importDirectoryButton.Width = 100; importDirectoryButton.Height = 23; importDirectoryButton.Text = "Import directory"; importDirectoryButton.Click += new EventHandler(importDirectoryButton_Click); this.Controls.Add(importDirectoryButton); importFilesButton = new Button(); importFilesButton.Anchor = AnchorStyles.Top | AnchorStyles.Right; importFilesButton.Location = new Point(tree.Location.X + tree.Width + 8, importDirectoryButton.Bottom + 8); importFilesButton.Width = 100; importFilesButton.Height = 23; importFilesButton.Text = "Import files"; importFilesButton.Click += new EventHandler(importFilesButton_Click); this.Controls.Add(importFilesButton); contextMenu = new ContextMenu(); contextMenu.Popup += new EventHandler(contextMenu_Popup); // tree.ContextMenu = contextMenu; importFilesMenuItem = new IconMenuItem("&Import Files", new Bitmap(WixFiles.GetResourceStream("bmp.import.bmp"))); importFilesMenuItem.Click += new System.EventHandler(importFilesMenuItem_Click); contextMenu.MenuItems.Add(importFilesMenuItem); newFolderMenuItem = new IconMenuItem("&New Folder", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp"))); newFolderMenuItem.Click += new System.EventHandler(newFolderMenuItem_Click); contextMenu.MenuItems.Add(newFolderMenuItem); importFolderMenuItem = new IconMenuItem("&Import Folder", new Bitmap(WixFiles.GetResourceStream("bmp.import.bmp"))); importFolderMenuItem.Click += new System.EventHandler(importFolderMenuItem_Click); contextMenu.MenuItems.Add(importFolderMenuItem); newSpecialFolderMenuItem = new IconMenuItem("New Special Folder", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp"))); foreach (string specialFolder in specialFolders) { IconMenuItem subItem = new IconMenuItem(specialFolder); subItem.Click += new EventHandler(specialFolderSubItem_Click); newSpecialFolderMenuItem.MenuItems.Add(subItem); } contextMenu.MenuItems.Add(newSpecialFolderMenuItem); newComponentMenuItem = new IconMenuItem("New Component", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp"))); newComponentMenuItem.Click += new EventHandler(newComponentMenuItem_Click); contextMenu.MenuItems.Add(newComponentMenuItem); deleteMenuItem = new IconMenuItem("&Delete", new Bitmap(WixFiles.GetResourceStream("bmp.delete.bmp"))); deleteMenuItem.Click += new EventHandler(deleteMenuItem_Click); contextMenu.MenuItems.Add(deleteMenuItem); XmlDocument wxsDoc = Wizard.WixFiles.WxsDocument; XmlNamespaceManager wxsNsmgr = Wizard.WixFiles.WxsNsmgr; XmlNodeList dirNodes = wxsDoc.SelectNodes("/wix:Wix/*/wix:Directory", wxsNsmgr); TreeNodeCollection treeNodes = tree.Nodes; InitTreeView(dirNodes); }
public void SetMenuItemOnStart() { SelectedMenuItem = NoteMenuItems.FirstOrDefault(); _settingNavigationService.NavigateTo(SelectedMenuItem.Tag); }
protected void PopupTreeViewContextMenu(System.Object sender, System.EventArgs e) { currTreeViewContextMenu.MenuItems.Clear(); if (currTreeView.SelectedNode == null) { return; } XmlNode node = currTreeView.SelectedNode.Tag as XmlNode; if (node == null) { return; } IconMenuItem item1 = new IconMenuItem("&New", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp"))); IconMenuItem item2 = new IconMenuItem("&Delete", new Bitmap(WixFiles.GetResourceStream("bmp.delete.bmp"))); item2.Click += new System.EventHandler(DeleteElement_Click); IconMenuItem item3 = new IconMenuItem("&Info", new Bitmap(WixFiles.GetResourceStream("bmp.info.bmp"))); item3.Click += new System.EventHandler(InfoAboutCurrentElement_Click); ArrayList newElementStrings = WixFiles.GetXsdSubElements(node.Name, SkipElements); bool isExtention = false; foreach (string newElementString in newElementStrings) { if (!isExtention && newElementString.Contains(":")) { item1.MenuItems.Add(new MenuItem("-")); isExtention = true; } MenuItem subMenuItem = new MenuItem(newElementString); subMenuItem.Click += new EventHandler(NewElement_Click); item1.MenuItems.Add(subMenuItem); } if (item1.MenuItems.Count > 0) { currTreeViewContextMenu.MenuItems.Add(item1); } currTreeViewContextMenu.MenuItems.Add(item2); XmlAttributeAdapter attAdapter = (XmlAttributeAdapter)CurrentGrid.SelectedObject; if (attAdapter != null) { XmlDocumentationManager docManager = new XmlDocumentationManager(WixFiles); if (docManager.HasDocumentation(attAdapter.XmlNodeDefinition)) { currTreeViewContextMenu.MenuItems.Add(new IconMenuItem("-")); currTreeViewContextMenu.MenuItems.Add(item3); } } AddCustomTreeViewContextMenuItems(node, currTreeViewContextMenu); }