禁用双击MDI表单的标题栏 [英] Disable double click on title bar of MDI form

查看:70
本文介绍了禁用双击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表单的标题栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆