[DUG] Screen resolution

Marshland Engineering marshland at marshland.co.nz
Sun Jul 15 20:10:45 NZST 2012


Is there a way to adjust all the visual componets on a form programatically 
?

Then I can do something like this.

   rWidScale:=Screen.Width/fmain.Width;
   rHeiScale:=Screen.Height/fmain.Height;

   fMain.Left:=0;                                                      // 
Set  the form to full screen
   fMain.Top:=0;
   fMain.Height:=Round(fMain.Height*rHeiScale);
   fMain.Width:=Round(fMain.Width*rWidScale);

   Button1.Top:=Round(Button1.Top*rHeiScale);    //Scale each visual 
component
   Button1.Left:=Round(Button1.Left*rWidScale);
   Button1.Height:=Round(Button1.Height*rHeiScale);
   Button1.Width:=Round(Button1.Width*rWidScale);
   Button1.Font.Size:=Round(Button1.Font.Size*rHeiScale);

   DBGrid1.Top:=Round(dbGrid1.Top*rHeiScale);  /// etc
   DBGrid1.Left:=Round(dbGrid1.Left*rWidScale);
   DBGrid1.Height:=Round(dbGrid1.Height*rHeiScale);
   DBGrid1.Width:=Round(dbGrid1.Width*rWidScale);
   DBGrid1.Font.Size:=Round(dbGrid1.Font.Size*rHeiScale);



More information about the Delphi mailing list