如何删除或禁用表单的关闭(X)按钮? [英] How to remove or disable Close (X)-button of the Form?

查看:143
本文介绍了如何删除或禁用表单的关闭(X)按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

客户希望表格右上角的关闭(X)按钮是

禁用或从Windows Form-application中删除,使用

VB .NET,但是留下MinimizeBox和MaximizeBox。


我认为这样做不是那么聪明,但必须像

客户想要的那样 - 那怎么办?它似乎不像改变属性,如MinimizeBox和MaximizeBox一样改变

。任何成功?


-

提前致谢!


Mika

Customer wants the Close (X)-button of the forms top right corner to be
Disabled or removed from Windows Form-application, which is made using
VB.NET, but leave MinimizeBox and MaximizeBox.

I think this is not so clever to do like this way, but have to do like
customer wants - so how to do this? It seems to be not just like
changing property like with MinimizeBox and MaximizeBox. Any succestions?

--
Thanks in advance!

Mika

推荐答案

Mika,


如果您确定您的用户需要它并且您没有发布

计划太其他了,(因为否则你很可能会直接将

与错误报告相对应,这可能是正确的)你可以使用结束事件并设置在那个e中。 .cancel = true(或错误我

总是对最后一次尝试表示怀疑)。


我会在你的情况下让用户签合同他想要这个。

你可以做的就是从clossing

事件的消息框中显示这是从你的客户端禁用的命令。 (多一点礼貌

然而不要误解文本而不是当然)。


而不是那样你可以重写X(并保持取消)

然而这将会有更多的工作。


我希望这有帮助吗?


Cor
Mika,

When you are sure your users wants it and you are not distributing the
program too others, (because otherwise you will most probably directly be
confrontated with bug reports which are probably justifiable correct) you
can just use the closing event and set in that e.cancel = true (or false I
always am in doubt about the last just try).

I would in your situation let the user sign a contract that he wanted this.
What you can do as well is showing in a the messagebox from the clossing
event that this is by order from your client disabled. (A little more polite
however not to misunderstand text than of course).

Instead of that all you can as well overpaint the X (and keep the cancel)
however that will be a lot more work.

I hope this helps?

Cor


#Region" Windows窗体设计器生成的代码


''禁用关闭

受保护的覆盖ReadOnly属性CreateParams()As CreateParams

获取

Dim cp As CreateParams = MyBase.CreateParams

Const CS_NOCLOSE As Integer =& H200

cp.ClassStyle = cp.ClassStyle或CS_NOCLOSE

返回cp

结束获取

结束财产

" Mika M"写道:
#Region " Windows Form Designer generated code "

''disables close
Protected Overrides ReadOnly Property CreateParams() As CreateParams
Get
Dim cp As CreateParams = MyBase.CreateParams
Const CS_NOCLOSE As Integer = &H200
cp.ClassStyle = cp.ClassStyle Or CS_NOCLOSE
Return cp
End Get
End Property
"Mika M" wrote:
客户希望窗体右上角的关闭(X)按钮被禁用或从Windows窗体应用程序中删除,这是使用
VB.NET,但是留下MinimizeBox和MaximizeBox。

我认为这样做不是那么聪明,但必须像客户想要的那样 - 所以如何做到这一点?它似乎不仅仅像改变MinimizeBox和MaximizeBox那样改变属性。任何成功?

-
提前致谢!

Mika
Customer wants the Close (X)-button of the forms top right corner to be
Disabled or removed from Windows Form-application, which is made using
VB.NET, but leave MinimizeBox and MaximizeBox.

I think this is not so clever to do like this way, but have to do like
customer wants - so how to do this? It seems to be not just like
changing property like with MinimizeBox and MaximizeBox. Any succestions?

--
Thanks in advance!

Mika



Mark ,


很好,我以前从未见过这个(现在在我的片段中)


谢谢


Cor
Mark,

Nice, I never saw this one before (is now in my snippets)

Thanks

Cor


这篇关于如何删除或禁用表单的关闭(X)按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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