この書き方は正方形が前提です。
//rateは大きさの倍率 public void ScalePictureBox(float rate = 0) { const int PictureBoxSize = 50;//元のpictureBox1のサイズ const int m_nextscale = (int)(rate * PictureBoxSize); //拡大させる pictureBox1.Height = m_nextscale; pictureBox1.Width = m_nextscale; Point centerPos = new Point(60, 15);//中心の座標 Point nextPos = new Point(0, 0); //位置を合わせる nextPos.X = (centerPos.X - pictureBox1.Width) / 2; nextPos.Y = (centerPos.Y - pictureBox1.Height) / 2; //中心に移動させる pictureBox1.Location = nextPos; }
考え方としては、pictureBox1は左上を基点に拡大しているので、拡大するごとに左上に移動させればいいです。