隐藏()和可见光之间的控制区别? [英] Control difference between Hide() and Visible?

查看:123
本文介绍了隐藏()和可见光之间的控制区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何使用控件的隐藏()相比可见属性设置为方法之间的差异假的。

I was wondering about the difference between using a Control’s Hide() method compared to setting the Visible property to false.

我何时会希望使用一个比其他?

When would I want to use the one over the other?

推荐答案

它们是等价的。从 Control.Hide :

隐藏控制相当于
将Visible属性设置为false。

Hiding the control is equivalent to setting the Visible property to false.

您可以用反射镜证实了这一点:

You can confirm this with reflector:

public void Hide()
{
    this.Visible = false;
}



当你知道你的价值可能会使用显示()或隐藏()和使用可见当你作为一个参数的知名度,虽然我个人一直使用可见光。

You might use Show() or Hide() when you know the value and use Visible when you take the visibility in as a parameter, although personally I would always use Visible.

这篇关于隐藏()和可见光之间的控制区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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