为了账号安全,请及时绑定邮箱和手机立即绑定

C#比例算法?

C#比例算法?

C#
MMTTMM 2019-02-15 15:11:27
C#比例算法
查看完整描述

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);
}


查看完整回答
反对 回复 2019-03-04
?
侃侃尔雅

TA贡献1801条经验 获得超16个赞

都放到Panel1里
然后用Scale方法
Panel1.Scale(0.5F);

查看完整回答
反对 回复 2019-03-04
  • 2 回答
  • 0 关注
  • 1006 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信