标签制作可见 [英] Label making Visible

查看:62
本文介绍了标签制作可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的winform中有2个标签。说1传递... 2次失败..在标签属性选项卡中,visiblity属性设置为FALSE。我有一些功能。我需要这样做..



如果该功能成功,那么第一个标签(通过)应该是可见的。如果功能失败然后第二个标签(失败)应该可见。



任何帮助都会非常感激..



在此先感谢..

I have 2 labels in my winform. say 1 is passed..2nd failed..The visiblity property is set to FALSE in both the labels property tab. I have some function doing.I need to do like this..

If that function is a success, then the 1st label(passed) should be made visible.If the function is a failure then the 2nd label(failed) should be made visible.

Any help would be really appreciated..

Thanks in advance..

推荐答案

您的问题完全不明白。当您的功能成功时,请制作

Your question is totally unclear to understand.When your function is a success then make
yourLabelName.Visible= true



当你的职能是失败然后成功


and when your function is a failure then make it

yourLabelName.Visible= false



查看一些例子..

http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/dfed6cbe-29ca-4e5c-b597-b9bf1b77305e [ ^ ]

http:/ /asp-net-example.blogspot.com/2009/03/how-to-show-hide-visible-label.html [ ^ ]


In你的表单,创建方法
In your form, create a method
ShowOutcome(bool success)
{
    successLabel.Visible = success;
    failureLabel.Visible = !success;

    // Eventually, do some more visual stuff like changing texts or so
}

当你的函数知道它是否成功时调用该方法。





要显示这两个标签,您可以创建这样一种方法:

Call that method when your function knows whether it is a success or not.


To display neither label, you can create such a method:

ClearOutcome()
{
    successLabel.Visible = failureLabel.Visible = false;
}

[/ Edit]


这篇关于标签制作可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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