打开窗体B代码:
private void Button_AddCard_Click(object sender, EventArgs e)
{
Form_AddDevice form_AddDevice = new Form_AddDevice("Card");
Point point = this.Location;
//窗体A的长度this.Width减去窗体B的长度465
int x = point.X+(this.Width- 465) /2;
int y = point.Y;
form_AddDevice.StartPosition = FormStartPosition.Manual;//需要使用属性定义窗体位置
form_AddDevice.Location=new Point(x,y);
form_AddDevice.Show();
}