【发布时间】:2013-11-25 21:51:07
【问题描述】:
我的标签名为:“number1”和图片框:“picturebox2”。我想在图片框的中心设置标签。我将标签放在图片框2的中心和顶部。默认情况下 number1.Text = "99"。如果 button1 被按下 number1.Text 更改为“1”并且这会制动标签的中心位置,因为它少了 1 个字符。
我使用这段代码使标签透明:
var pos = this.PointToScreen(number1.Location);
pos = pictureBox2.PointToClient(pos);
number1.Parent = pictureBox2;
number1.Location = pos;
number1.BackColor = Color.Transparent;
如何在标签中的数字更改时将标签放置在图像的中心?
【问题讨论】:
-
给标签的textChanged事件赋值一个函数,并改变位置。
-
你能给我提供代码吗...因为我是菜鸟 :) 听起来不错,但不知道该怎么做。