为什么打破标签 [英] why breake the label

查看:55
本文介绍了为什么打破标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个

label.Text="inventory system"


当我调整窗口大小时,它会像这样
破裂 库存
系统

为什么?


When I resize the window it gets break like this
inventory
system

why?

推荐答案

我猜它会根据可用宽度进行调整.当您最小化屏幕时,可以用更少的空间在一行中显示这两个单词,这就是为什么它被清单"和系统"之间的空格所包裹.您可以通过删除它们之间的间距来进行检查.
I guess it adjusts itself according to the available width. When you minimize your screen there is less space available to display these two words in single line that is why it wraps by the space between "inventory" and "system". You can check this by removing the space between them.


如果您不希望这样做会破坏标签.然后您可以固定标签的宽度.
这是一个替代解决方案. :)
If you don''t want this should break the label. then you can fix the width of your label.
This is an alternative solution. :)


set the AutoSize property to true. The label will adjust its length so all the text is visible, if the label is wider than the form, the entire label will not be visible


Try this, simply modify in your code with this..

private void InitializeLabel()
	{
		this.Label1 = new Label();
		this.Label1.Location = new System.Drawing.Point(10, 10);
		this.Label1.Name = "Label1";
		this.Label1.TabIndex = 0;

		this.Label1.Size = new System.Drawing.Size(10, 10);
		this.Controls.Add(this.Label1);
		this.Label1.AutoSize = true;
		this.Label1.Text = "text" +  
			"text";

	}


这篇关于为什么打破标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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