的WinForms按钮:不可见=假暗示启用=假? [英] Winforms button: Does Visible = false imply Enabled = false?

查看:87
本文介绍了的WinForms按钮:不可见=假暗示启用=假?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简单问题:(可以肯定,如果有人点击了空间,无形按钮的生活,也不会激活它)我有一个WinForms按钮,我想使它既(有条件)隐形和残疾人是否 button.Visible = FALSE ,也意味着 button.Enabled = FALSE ,或者我需要设置/复位这两个属性在适当的时候?

Simple question: I have a WinForms button, and I want to make it both (conditionally) invisible and disabled (to be sure that if someone clicks in the space where the invisible button lives, it won't activate it.) Does button.Visible = false also imply button.Enabled = false, or do I need to set/reset both properties at the appropriate time?

推荐答案

如果该控件是不可见的,它实际上是被禁止。点击哪里会出现的区域(或进出该区域的滚动)均可见它不会导致事件激发。

If the control is not visible, it is effectively disabled. Clicking in the area where it would appear (or rolling in and out of that area) were it visible will not cause an event to fire.

编辑:为了澄清,根据其他的反应和意见,该按钮的的残疾人和潜在的事件功能仍然可用的编程的,但按钮不会物理/可在表单上可见,用户将无法以任何方式与它进行交互(除非您作为程序员,提供另一种方法的编程的)。

To clarify, based on other responses and comments, the button is not disabled and underlying event functionality is still available programmatically, but the button will not be physically available/visible on the form and the user will not be able to interact with it in any way (unless you, as the programmer, provide another method programmatically).

这篇关于的WinForms按钮:不可见=假暗示启用=假?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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