禁用双击MDI表单的标题栏

编程入门 行业动态 更新时间:2024-10-28 08:22:11
本文介绍了禁用双击MDI表单的标题栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的窗口应用程序的mdi形式有不可见的max按钮, 现在,请帮助 防止双击MDI表单窗口的标题栏 ,以使 MDI不能在双击时调整大小. 我该怎么办,请帮助我 在此先感谢

I have invisible max button of mdi form of my window application, Now please help to Prevent double click on title bar of MDI form window so that MDI can ''t resize on double click. How can I do this ,Please help me Thanks in advance

推荐答案

我刚刚在MDIParent和MDIChild表单上都尝试过此操作,但是如果将MaximiseBox属性设置为FALSE,则双击标题栏不会执行任何操作,设置如果设置为TRUE,则表示双击将使被单击的窗口最大化. I have just tried this on both the MDIParent and MDIChild forms, but if you set MaximiseBox property to FALSE, double clicking the titlebar does nothing, setting it to TRUE means a double click causes the clicked window to maximise.

我认为以下内容可能会对某人有所帮助,因为它对我来说非常有效... I think the below might be of some help to someone, since it worked very finely for me... Protected Overloads Overrides Sub WndProc(ByRef m As Message) 'Define DoubleClick... Const WM_NCLBUTTONDBLCLK As Integer = &HA3 'Define LeftButtonDown event... Const WM_NCLBUTTONDOWN As Integer = 161 'Define MOVE action... Const WM_SYSCOMMAND As Integer = 274 'Define that the WM_NCLBUTTONDOWN is at TitleBar... Const HTCAPTION As Integer = 2 'Trap MOVE action... Const SC_MOVE As Integer = 61456 'Disable moving TitleBar... If (m.Msg = WM_SYSCOMMAND) AndAlso (m.WParam.ToInt32() = SC_MOVE) Then Exit Sub End If 'Track whether clicked on TitleBar... If (m.Msg = WM_NCLBUTTONDOWN) AndAlso (m.WParam.ToInt32() = HTCAPTION) Then Exit Sub End If 'Disable double click on TitleBar... If (m.Msg = WM_NCLBUTTONDBLCLK) Then Exit Sub End If MyBase.WndProc(m) End Sub

谢谢大家

Thanks guys

尝试一下: Try this: private void Form1_Resize(object sender, EventArgs e) { if (WindowState == FormWindowState.Maximized) { WindowState = FormWindowState.Normal; } }

唯一的麻烦是它可能会闪烁:窗口将短暂最大化,然后恢复正常.

The only slight hassle is that it may flicker: the window will be maximized briefly, and then returned to normal.

更多推荐

禁用双击MDI表单的标题栏

本文发布于:2023-11-10 01:27:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1573983.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:双击   表单   标题栏   MDI

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!