方法一,panel1大小不会变
procedure TForm4.FormResize(Sender: TObject); begin panel1.Top:= (form4.ClientHeight- panel1.Height)div 2; panel1.Left:= (form4.ClientWidth- panel1.Width)div 2; end;
方法二,设置Panel1的Anchors