Windows窗体标签可见性属性问题 [英] windows form label visibility property problem
问题描述
我正在尝试创建一个win表单。其中有一个默认不可见的标签。基于条件,我将其可见性设置为true。但是有一个问题。
如果我在没有调试的情况下运行程序就无法看到标签。
但是当我调试到我更改可见性属性然后点击F5的地方时,我能够看到。奇怪的rt ???请帮帮我
这是代码
Hi,
I am trying to create a win form.In it there is a label which by default is not visible. Based on a condition i am setting its visibility to true. But one issue is there.
If i run the program without debugging am not able to see the label.
But when i debug to the place where i change the visibility property and then hit F5 , i am able to see. Weird rt??? please help me
THis is the code
if (_dtWorkitems != null && _dtWorkitems.Rows.Count > 0)
{
pgBar.Minimum = 1;
pgBar.Maximum = _dtWorkitems.Rows.Count;
pgBar.Step = 1;
pgBar.Visible = true;
txtMsg.Visible = true;
}
条件如果数据表不为null,那么我正在改变可见性。然后我循环数据表。最后我改变了标签的属性&进度条回到假。我尝试评论,退出循环后显示标签。为什么
The condition was that if a data table is not null then i am changing the visibility. Then i am looping the datatable . At the end i am changing the property of the label & progressbar back to false. I tried commenting that and the label was shown after exiting the loop. Why
推荐答案
尝试调用invalidate或update或者其他东西。这应该强制重绘。
如果你从一开始就看到标签。那么呢?
try calling invalidate or update or something. that should force a redraw.
If you leave the label visible from the start. is it there then?
这篇关于Windows窗体标签可见性属性问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!