如何使标签在WinForms中居中? [英] How do I keep a label centered in WinForms?
本文介绍了如何使标签在WinForms中居中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 WinForms
中,我正在使用 Label
来显示不同的消息,例如成功,失败等。
In WinForms
I am using a Label
to display different messages like success, failure, etc.
我想在中心表格中将该标签居中。我想要一个解决方案,使标签中只有一个单词还是整个句子都可以居中。
I'd like to center that label in the center form. I want a solution that will keep it centered whether there's just one word or a whole sentence in the label.
推荐答案
设置标签
的 AutoSize
属性为 False
,将TextAlign
属性设置为 MiddleCenter
,将 Dock
属性设置为 Fill
。
Set Label
's AutoSize
property to False
, TextAlign
property to MiddleCenter
and Dock
property to Fill
.
这篇关于如何使标签在WinForms中居中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文