如何删除继承表单中的按钮 [英] How can i delete a button in Inherited Form

查看:80
本文介绍了如何删除继承表单中的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI伙计。



我有两种形式。

在Form1中我有一个按钮(btnExit),代码如下:application。退出();

在Form2中(它是Form1的继承形式),我想删除btnExit,但这是不可能的。



我可以问一下是否有人知道我该如何解决这个错误?

i删除了Form1中的btnExit,但它还没有在Form2中。!!!!

HI Guys.

I have two form.
In Form1 i have a button(btnExit) with this code: application.exit();
In Form2(it''s Inherited Form of Form1), i want to delete btnExit,but it''s impossible.

Can I ask if someone have an idea to how can i fix this error?
i deleted the btnExit in Form1 but its in Form2 yet.!!!!

推荐答案

您无法从表单2中删除该按钮。你只能在Form1的设计师视图中这样做。



但是,你可以在Form2的构造函数中做这样的事情。



You cannot delete the button from form two. You can only do it in Form1''s designer view.

However, you can do something like this in the Form2''s constructor.

this.btnExit.Visible = false;





PS:

顺便问一下,你为什么需要这样做?如果您的Form1包含其子项不必要的项目,则必须存在设计问题。父类应该只有所有子代共有的东西。



P.S.:
By the way, why do you need to do this? If your Form1 contains items not necessary for it''s children, there must be a problem with design. Parent classes should only have things that are common to all its children.


这篇关于如何删除继承表单中的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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