Windows窗体标签显示希望覆盖屏幕上已经存在的文本 [英] Windows Forms Label Display wish to overwrite text already on screen

查看:214
本文介绍了Windows窗体标签显示希望覆盖屏幕上已经存在的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Am使用Label显示标题.
希望用标题2覆盖标题1.
如果增加y坐标以避免覆盖-显示起作用.
必须是显示覆盖问题.

谁能帮忙.

您猜想我是Windows窗体的新手.

Am using Label to show headings.
Wish to overwrite heading1 with heading2.
If y coordinate increased to avoid overwrite - display works.
Must be a display overwriting issue.

Can anyone help.

You guessed I am new to Windows Forms.

推荐答案

我假设您有2个标签,并且您尝试将其中一个放置在另一个标签上?但这行不通,因为基础标签比另一个标签更高.如果我的假设是正确的,那么您有两种方法可以解决此问题:

1.根据需要隐藏/显示标签.因此,如果您希望heading2可见,请隐藏heading1,反之亦然.

2.使用单个Label 控件,并根据需要交换文本.
I assume you have 2 labels and you are trying to put one of them over the other? And that''s not working because the underlying label is taller than the other one. If my assumption is correct, then you have two ways to work around this:

1. Hide/show the labels as required. So if you want heading2 visible, hide heading1 and vice-versa.

2. Use a single Label control, and swap the text as required.


如果您的最终目标是使heading2可见,而heading1不可见,那么为什么不直接更改.text呢?标签的字段",而不是尝试将第二个标签移到第一个标签上.只需设置文本值即可,而不要具有2个UI对象.

[附加]您可能需要确保将AutoSize属性设置为true,以确保标签可以调整为新文本的大小.
If your ultimate goal is to have heading2 visible and heading1 not visible, then why not just change the .text field of the label instead of trying to move a second label over the first. Just set the text value instead of having 2 UI objects.

[Addition] You may need to make sure the AutoSize property is set to true to ensure that the label resizes to the new text.


这篇关于Windows窗体标签显示希望覆盖屏幕上已经存在的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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