static public MenuItem CloneMenu(MenuItemVS currentItem) { MenuItemVS clonedItem = new MenuItemVS(currentItem.Text, (Bitmap)currentItem.Icon, (Shortcut)currentItem.Shortcut, currentItem.ClickHandler); // Preserve the enable and check state clonedItem.Enabled = currentItem.Enabled; clonedItem.Checked = currentItem.Checked; clonedItem.RadioCheck = currentItem.RadioCheck; foreach (MenuItemVS item in currentItem.MenuItems) { clonedItem.MenuItems.Add(CloneMenu(item)); } return(clonedItem); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this._mainMenu = new System.Windows.Forms.MainMenu(); this._miDisplay = new ActiveQLibrary.CustomControl.MenuItemVS(); this._miDisplayMainLog = new ActiveQLibrary.CustomControl.MenuItemVS(); this._miDisplayOverview = new ActiveQLibrary.CustomControl.MenuItemVS(); this._miDisplayStandardMail = new ActiveQLibrary.CustomControl.MenuItemVS(); this._miDisplayScheduledMail = new ActiveQLibrary.CustomControl.MenuItemVS(); this._miDisplayTask = new ActiveQLibrary.CustomControl.MenuItemVS(); this._miAbout = new ActiveQLibrary.CustomControl.MenuItemVS(); this.SuspendLayout(); // // _mainMenu // this._mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this._miDisplay, this._miAbout}); // // _miDisplay // this._miDisplay.ClickHandler = null; this._miDisplay.Icon = null; this._miDisplay.ImageIndex = -1; this._miDisplay.ImageList = null; this._miDisplay.Index = 0; this._miDisplay.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this._miDisplayMainLog, this._miDisplayOverview, this._miDisplayStandardMail, this._miDisplayScheduledMail, this._miDisplayTask}); this._miDisplay.OwnerDraw = true; this._miDisplay.ShortcutText = ""; this._miDisplay.Text = "&Display"; this._miDisplay.TransparentColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(192))); // // _miDisplayMainLog // this._miDisplayMainLog.Checked = true; this._miDisplayMainLog.ClickHandler = null; this._miDisplayMainLog.Icon = null; this._miDisplayMainLog.ImageIndex = -1; this._miDisplayMainLog.ImageList = null; this._miDisplayMainLog.Index = 0; this._miDisplayMainLog.OwnerDraw = true; this._miDisplayMainLog.ShortcutText = ""; this._miDisplayMainLog.Text = "&Main log"; this._miDisplayMainLog.TransparentColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(192))); this._miDisplayMainLog.Click += new System.EventHandler(this._miDisplayMainLog_Click); // // _miDisplayOverview // this._miDisplayOverview.ClickHandler = null; this._miDisplayOverview.Icon = null; this._miDisplayOverview.ImageIndex = -1; this._miDisplayOverview.ImageList = null; this._miDisplayOverview.Index = 1; this._miDisplayOverview.OwnerDraw = true; this._miDisplayOverview.ShortcutText = ""; this._miDisplayOverview.Text = "&Overview"; this._miDisplayOverview.TransparentColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(192))); this._miDisplayOverview.Click += new System.EventHandler(this._miDisplayOverview_Click); // // _miDisplayStandardMail // this._miDisplayStandardMail.ClickHandler = null; this._miDisplayStandardMail.Icon = null; this._miDisplayStandardMail.ImageIndex = -1; this._miDisplayStandardMail.ImageList = null; this._miDisplayStandardMail.Index = 2; this._miDisplayStandardMail.OwnerDraw = true; this._miDisplayStandardMail.ShortcutText = ""; this._miDisplayStandardMail.Text = "&Standard mail"; this._miDisplayStandardMail.TransparentColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(192))); this._miDisplayStandardMail.Click += new System.EventHandler(this._miDisplayStandardMail_Click); // // _miDisplayScheduledMail // this._miDisplayScheduledMail.ClickHandler = null; this._miDisplayScheduledMail.Icon = null; this._miDisplayScheduledMail.ImageIndex = -1; this._miDisplayScheduledMail.ImageList = null; this._miDisplayScheduledMail.Index = 3; this._miDisplayScheduledMail.OwnerDraw = true; this._miDisplayScheduledMail.ShortcutText = ""; this._miDisplayScheduledMail.Text = "S&cheduled mail"; this._miDisplayScheduledMail.TransparentColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(192))); this._miDisplayScheduledMail.Click += new System.EventHandler(this._miDisplayScheduledMail_Click); // // _miDisplayTask // this._miDisplayTask.ClickHandler = null; this._miDisplayTask.Icon = null; this._miDisplayTask.ImageIndex = -1; this._miDisplayTask.ImageList = null; this._miDisplayTask.Index = 4; this._miDisplayTask.OwnerDraw = true; this._miDisplayTask.ShortcutText = ""; this._miDisplayTask.Text = "&Task"; this._miDisplayTask.TransparentColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(192))); this._miDisplayTask.Click += new System.EventHandler(this._miDisplayTask_Click); // // _miAbout // this._miAbout.ClickHandler = null; this._miAbout.Enabled = false; this._miAbout.Icon = null; this._miAbout.ImageIndex = -1; this._miAbout.ImageList = null; this._miAbout.Index = 1; this._miAbout.OwnerDraw = true; this._miAbout.ShortcutText = ""; this._miAbout.Text = "&About"; this._miAbout.TransparentColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(192))); // // MainForm // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(474, 429); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Menu = this._mainMenu; this.Name = "MainForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "ActiveQ"; this.WindowState = System.Windows.Forms.FormWindowState.Minimized; this.Closing += new System.ComponentModel.CancelEventHandler(this.MainForm_Closing); this.Load += new System.EventHandler(this.MainForm_Load); this.ResumeLayout(false); }
static public MenuItem CloneMenu(MenuItemVS currentItem) { MenuItemVS clonedItem = new MenuItemVS(currentItem.Text, (Bitmap)currentItem.Icon, (Shortcut)currentItem.Shortcut, currentItem.ClickHandler); // Preserve the enable and check state clonedItem.Enabled = currentItem.Enabled; clonedItem.Checked = currentItem.Checked; clonedItem.RadioCheck = currentItem.RadioCheck; foreach (MenuItemVS item in currentItem.MenuItems) { clonedItem.MenuItems.Add(CloneMenu(item)); } return clonedItem; }