2 回答
小唯快跑啊
TA贡献1863条经验 获得超2个赞
private double xp;
private double yp;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
xp = (this.label1.Location.X - this.pictureBox1.Location.X) / Convert.ToDouble(this.pictureBox1.Size.Width);
yp = (this.label1.Location.Y - this.pictureBox1.Location.Y) / Convert.ToDouble(this.pictureBox1.Size.Height);
}
private void pictureBox1_SizeChanged(object sender, EventArgs e)
{
int x = Convert.ToInt32(this.pictureBox1.Size.Width * xp + this.pictureBox1.Location.X);
int y = Convert.ToInt32(this.pictureBox1.Size.Height * yp + this.pictureBox1.Location.Y);
this.label1.Location = new Point(x, y);
}
- 2 回答
- 0 关注
- 1006 浏览
添加回答
举报
0/150
提交
取消