首页 > 代码库 > xtraTabbedMdiManager的标题上右鍵弹出关闭窗体菜单
xtraTabbedMdiManager的标题上右鍵弹出关闭窗体菜单
实现一个增值功能, 在xtraTabbedMdiManager组件TabPage标题上右鍵弹出关闭当前窗体的菜单.
C# Code:
private void xtraTabbedMdiManager1_MouseUp(object sender, MouseEventArgs e)
{
//点左键无效, 必须是点右键弹出菜单
if (e.Button != MouseButtons.Right) return;
BaseTabHitInfo hint = xtraTabbedMdiManager1.CalcHitInfo(e.Location);
//点击有效,且点击在TabPage标题上
if (hint.IsValid && (hint.Page != null))
{
//有效子窗体
if (xtraTabbedMdiManager1.SelectedPage.MdiChild != null)
{
Point p = xtraTabbedMdiManager1.SelectedPage.MdiChild.PointToScreen(e.Location);
menuStripCloseForm.Show(p); //显示弹出菜单
}
}
}
//来源:C/S框架网(www.csframework.com) QQ:1980854898
private void xtraTabbedMdiManager1_MouseUp(object sender, MouseEventArgs e)
{
//点左键无效, 必须是点右键弹出菜单
if (e.Button != MouseButtons.Right) return;
BaseTabHitInfo hint = xtraTabbedMdiManager1.CalcHitInfo(e.Location);
//点击有效,且点击在TabPage标题上
if (hint.IsValid && (hint.Page != null))
{
//有效子窗体
if (xtraTabbedMdiManager1.SelectedPage.MdiChild != null)
{
Point p = xtraTabbedMdiManager1.SelectedPage.MdiChild.PointToScreen(e.Location);
menuStripCloseForm.Show(p); //显示弹出菜单
}
}
}
//来源:C/S框架网(www.csframework.com) QQ:1980854898
菜单事件:
C# Code:
private void menuItemCloseWindow_Click(object sender, EventArgs e)
{
xtraTabbedMdiManager1.SelectedPage.MdiChild.Close();
}
private void menuItemCloseWindow_Click(object sender, EventArgs e)
{
xtraTabbedMdiManager1.SelectedPage.MdiChild.Close();
}
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。