如何AUTOSIZE一个标签的高度,但不会将宽度 [英] How to AutoSize the height of a Label but not the width

查看:215
本文介绍了如何AUTOSIZE一个标签的高度,但不会将宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个面板,我正在创建编程;此外我添加几个组件到它。

I have a Panel that I'm creating programmatically; additionally I'm adding several components to it.

这些组件之一是标签将包含用户生成的内容。

One of these components is a Label which will contain user-generated content.

我不知道该标签应该有多高是的,但它确实有一个固定的宽度。

I don't know how tall the label should be, but it does have a fixed width.

我如何设置的高度,使其显示的所有文字,不改变宽度?

How can I set the height so that it displays all the text, without changing the width?

推荐答案

只需使用自动调整大小属性,将其设置回

Just use the AutoSize property, set it back to True.

设置 MAXIMUMSIZE 属性,比方说,(60,0),因此它不能横向生长,只有垂直。

Set the MaximumSize property to, say, (60, 0) so it can't grow horizontally, only vertically.

这篇关于如何AUTOSIZE一个标签的高度,但不会将宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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