如何在Windows窗体中显示单击另一个标签的标签 [英] How to show a label clicking on another in windows form

查看:96
本文介绍了如何在Windows窗体中显示单击另一个标签的标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的软件中添加帮助表单,我希望当我点击问题时,答案将在其下方打开。

在我的表单中,链接标签有问题和答案有一个标签。



i在linkLabel_click事件中尝试了这个

I want to put help form in my software and i want that when i click on the question the answer will open below it.
In my form a link label is there for question an for answer there is a label.

i tried this

label1.visible=ture 

但它保留了表格中的空白区域,即使它不可见。



我希望它不应该保留标签的位置(答案),当我点击它时问答节目答案。



可以帮助我吗??

in the linkLabel_click event but it keeps the blank space in the form even when it is not visible.

I want that it should not keep the place of the label(answer) and when i click on the question the shows the answer.

Can any on help me??

推荐答案

我假设你这意味着,当标签无法辨认时,它不会占用你的表格空间吗?

隐形:

I assume that you mean that when the lable is invlisible, it takes up no space on your form?
Invisible:
 -------  
|Button1|
 -------
 -------  
|Button2|
 -------

可见:

Visible:

 -------  
|Button1|
 -------
  Label
 ------- 
|Button2|
 -------



与网页不同,winforms没有自动方式。 (谢天谢地)

想一想:网页不是固定大小 - 它们随浏览器移动和改变。 WinForms不 - 您指定表单的大小和位置,并指定表单中每个控件的大小和位置。如果使控件不可见改变了其他控件的位置,那么表单的大小(可能)也必须改变 - 与其他应用程序相比,这看起来很奇怪。



您可以这样做,但是每当您更改可见性时,您都必须手动将标签下方的所有控件移动。



我不会如果我是你,那就去做吧!


There is no automatic way to do that with winforms, unlike web pages. (Thankfully)
Think about it: web pages are not fixed size - they move and change with the browser. WinForms don''t - you specify the size, and location of teh form, and you specify the size and location of each control within the form. If making a control invisible changed the placement of other controls, then the size of the form would (probably) also have to change - which would look very odd when compared to other applications.

You can do it, but you would have to manually move all controls "below" the label whenever you changed the visibility.

I wouldn''t do it if I was you!


这篇关于如何在Windows窗体中显示单击另一个标签的标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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