We know that the screen resolution settings affect the layout of the form, assuming that the screen resolution on your machine is 800*600, and eventually the machine resolution to distribute the application is 640*480, or 1024*768, so that the form you originally designed will become distorted on the new machine. At this point you will want the form to adapt to the different resolution, there are two ways for you to refer to.
Automatically redraw forms and controls according to the new resolution
First, define two constants in the interface section of the form, representing the width and height (in pixels) of the screen at design time. In the form's Create event, first determine whether the current resolution is the same as the design resolution, and if different, the scale procedure that invokes the form can adjust the width and height of the controls in the form again.
Const
Orignwidth=800;
Orignheight=600;
procedureTForm1.FormCreate(Sender:TObject);
begin
scaled:=true;
if(screen.width<>orignwidth)then
begin
height:=longint(height)*longint
(screen.height)divorignheight;
width:=longint(width)*longint
(screen.width)divorignwidth;
scaleby(screen.width,orignwidth);
end;
end;
The scale process adjusts the width and height of the control and automatically resizes the control font to fit the new resolution, but it does not change the position of the control's vertex coordinates, that is, the process does not change the relative position between controls. To adjust the relative position of the selection between controls, you also need to programmatically implement them, and interested readers can try.