/// <summary> /// Occurs on a mouse click in the main Panel. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void expandablePanelControl_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { if (!EnableContextMenu) { return; } int x = e.X; int y = e.Y; if (sender != this) { Control ctl = (Control)sender; x += ctl.Bounds.X; y += ctl.Bounds.Y; } m_contextMenuStrip.Enabled = EnableContextMenu; m_contextMenuStrip.Show(this, new Point(x, y)); m_contextMenuStrip.BringToFront(); return; } SwitchStatus(); }
private void ContextMenuStrip_Opening(object sender, CancelEventArgs e) { ContextMenuStrip cmenuStrip = sender as ContextMenuStrip; if (cmenuStrip != null && !cmenuStrip.IsDisposed) { cmenuStrip.BringToFront(); } }
/// <summary> /// 打开多例模式下的对象 /// </summary> /// <param name="isShowTop">是否显示为顶层窗体</param> /// <returns></returns> public Control initPrototypeExample(bool isShowTop) { ContextMenuStrip conThis = table_rightStrip; conThis.Name = EnumUtils.GetDescription(DefaultNameEnum.DATA_VIEW_RIGHT_MENU) + DateTime.Now.Ticks.ToString();; if (isShowTop) { conThis.BringToFront(); } // 加入到多例工厂 ControlCacheFactory.addPrototypeCache(DefaultNameEnum.DATA_VIEW_RIGHT_MENU, conThis); return(conThis); }
private void DeleteFolderMusic_Click(object sender, EventArgs e) { toolStrip.Items.Clear(); toolStrip.LayoutStyle = ToolStripLayoutStyle.VerticalStackWithOverflow; foreach (string item in ListFolderLocalMusic.Instance.GetLink()) { toolStrip.Items.Add(item); } toolStrip.Show(MousePosition); toolStrip.BringToFront(); toolStrip.GripStyle = ToolStripGripStyle.Hidden; toolStrip.Dock = DockStyle.None; }
private void btn_Addto_Click(object sender, EventArgs e) { toolStrip.Items.Clear(); toolStrip.Items.Add("Now playing"); toolStrip.LayoutStyle = ToolStripLayoutStyle.VerticalStackWithOverflow; toolStrip.Items.Add("-"); toolStrip.Items.Add("New playlist"); foreach (PlayListInfoVideo item in PlaylistVideo.Instance.GetAllPlayListVideo()) { toolStrip.Items.Add(item.Name_PL); } toolStrip.Show(MousePosition); toolStrip.BringToFront(); toolStrip.GripStyle = ToolStripGripStyle.Hidden; toolStrip.Dock = DockStyle.None; }
/// <summary> /// Occurs on a mouse click in the main panel. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> internal void expandablePanelControl_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right && !m_enableContextMenu) { return; } if (e.Button == MouseButtons.Right) { int height = (ExpandDirection == Direction.Up ? Height - nfpHeader.Height + e.Y : e.Y); contextMenuStrip.Enabled = m_enableContextMenu; contextMenuStrip.Show(this, new Point(e.X, height)); contextMenuStrip.BringToFront(); return; } SwitchStatus(); }
private void NotifyClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { // If left clicked, show all open forms. foreach (Form form in Application.OpenForms) { form.Show(); } } else if (e.Button == MouseButtons.Right) { // If right clicked, display bar icon context. barIconContext.Show(MousePosition); barIconContext.BringToFront(); } }
void B_Title_Click(object sender, MouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Left) { M_SelectPopupItemSetting(_leftItems); M_SelectPopup.Show(this, e.X, e.Y); M_SelectPopup.BringToFront(); } else if (e.Button == MouseButtons.Right) { M_SelectPopupItemSetting(_rightItems); M_SelectPopup.Show(this, e.X, e.Y); M_SelectPopup.BringToFront(); } else if (e.Button == System.Windows.Forms.MouseButtons.Middle) { M_SelectPopupItemSetting(_rightItems); M_SelectPopup.Show(this, e.X, e.Y); M_SelectPopup.BringToFront(); } else if (e.Button == System.Windows.Forms.MouseButtons.XButton1) { M_SelectPopupItemSetting(_rightItems); M_SelectPopup.Show(this, e.X, e.Y); M_SelectPopup.BringToFront(); } else if (e.Button == System.Windows.Forms.MouseButtons.XButton2) { M_SelectPopupItemSetting(_rightItems); M_SelectPopup.Show(this, e.X, e.Y); M_SelectPopup.BringToFront(); } else if (e.Button == System.Windows.Forms.MouseButtons.None) { M_SelectPopupItemSetting(_rightItems); M_SelectPopup.Show(this, e.X, e.Y); M_SelectPopup.BringToFront(); } else { M_SelectPopupItemSetting(_rightItems); M_SelectPopup.Show(this, e.X, e.Y); M_SelectPopup.BringToFront(); } }
private void btn_Addto_Click(object sender, EventArgs e) { toolStrip.Items.Clear(); toolStrip.Items.Add("Now playing"); toolStrip.LayoutStyle = ToolStripLayoutStyle.VerticalStackWithOverflow; toolStrip.Items.Add("-"); toolStrip.Items.Add("New playlist"); int Y = 400; foreach (PlayListInfo item in Playlist.Instance.GetAllPlayListMusic()) { toolStrip.Items.Add(item.Name_PL); Y -= 22; } toolStrip.Location = new Point(btn_Addto.Location.X + 70, btn_Addto.Location.Y + Y); toolStrip.Show(MousePosition); toolStrip.BringToFront(); toolStrip.GripStyle = ToolStripGripStyle.Hidden; toolStrip.Dock = DockStyle.None; }
/// <summary> /// 打开单例模式下的对象 /// </summary> /// <param name="isShowTop">是否显示为顶层窗体</param> /// <returns></returns> public Control initSingleExample(bool isShowTop) { ContextMenuStrip conThis = null; Control con = ControlCacheFactory.getSingletonCache(DefaultNameEnum.DATA_VIEW_RIGHT_MENU); if (con == null || !(con is ContextMenuStrip)) { conThis = table_rightStrip; conThis.Name = EnumUtils.GetDescription(DefaultNameEnum.DATA_VIEW_RIGHT_MENU); ControlCacheFactory.addSingletonCache(conThis); } else { conThis = (ContextMenuStrip)con; } if (isShowTop) { conThis.BringToFront(); } return(conThis); }