我的标签是:"number1“和"picturebox2”。我想把标签放在画框的中间。我把标签放在picturebox2的中央和顶部。默认情况下为1.Text= "99“。如果按下button1编号1,文本将改为"1“,而这个制动器中心位置的标签是因为少了1个字符。
我使用此代码使标签透明:
var pos = this.PointToScreen(number1.Location);
pos = pictureBox2.PointToClient(pos);
number1.Parent = pictureBox2;
number1.Location = pos;
number1.BackColor = Color.Transparent;当标签中的数字发生变化时,我如何将标签放置在图像的中心?
发布于 2013-11-13 10:45:38
将Label AutoSize属性更改为False,将标签的Width设置为PictureBox的宽度,并将TextAlign属性更改为MiddleCenter。这应该能满足你的要求。
https://stackoverflow.com/questions/19951345
复制相似问题