【问题标题】:How to Disable restore box of windows form when it is in maximized condition?如何在最大化状态下禁用Windows窗体的还原框?
【发布时间】:2013-07-25 06:51:22
【问题描述】:

如何在 c# 中禁用 windows 窗体控制框中的恢复按钮。我需要在加载时使表单处于最大化状态。可能吗?即使最大化框属性为假,还原框也会自动显示在屏幕上。

【问题讨论】:

标签: c# .net winforms


【解决方案1】:

看看这个问题: How do I remove minimize and maximize from a resizable window in WPF?

第一个也是最受好评的答案不仅仅属于 WPF。所以它也应该适用于 Winforms 应用程序。

【讨论】:

  • 当您可以简单地在设计器中设置属性时,使用 pinvoke 毫无意义。
【解决方案2】:

所以从我的评论中你可以这样做:

// Define the border style of the form to a dialog box.
form1.FormBorderStyle = FormBorderStyle.FixedDialog;

// Set the MaximizeBox to false to remove the maximize box.
form1.MaximizeBox = false;

// Set the MinimizeBox to false to remove the minimize box.
form1.MinimizeBox = false;

这是来自MSDN

要最大化您的表单,您只需执行以下操作:

form1.WindowState = FormWindowState.Maximized;

这也可以在MSDN找到

【讨论】:

  • 我已将表单属性设置如下 FormBorderStyle = FixedDialog;最大化框 = 假;最小化框 = 假; windowsState = 最大化;但它不工作。恢复密钥自动出现。
  • @Roys - 你将不得不给我更多的东西让我帮助你,你在做什么来解决这个问题?您在哪里使用过此代码?等
【解决方案3】:

在属性面板中设置ResizeMode = CanMinimizewindowState = Maximized

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-01-23
    • 1970-01-01
    • 1970-01-01
    • 2011-07-15
    • 2011-01-11
    • 1970-01-01
    • 2020-07-06
    • 1970-01-01
    相关资源
    最近更新 更多