I got problems with my screen resizing, when I for example developed a
screen on 800x600 and someone has to run it on 640x480 then the form
doesn't fit on the screen, I have solved this with the following code
(found on http://www.delphideli.com/resolut.htm) with thanks to Bruce A.
Smidt and Bill Pennal for point me in the right direction.
Anyway there's the following code:
implementation
const
ScreenWidth: LongInt = 800; {I designed my form in
800x600 mode.}
ScreenHeight: LongInt = 600;
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
scaled := true;
if (screen.width <> ScreenWidth) then
begin
height := longint(height) * longint(screen.height)
DIV ScreenHeight;
width := longint(width) * longint(screen.width) DIV
ScreenWidth;
scaleBy(screen.width, ScreenWidth);
end;
end;
This works really great! BUT when you use large fonts (or other fonts for
example) then you need to do an extra thing this is also on that page and
is listed here:
USES typinfo; {Add this to your USES statement.}
var i: integer;
begin
for i := componentCount - 1 downto 0 do
with components[i] do
begin
if GetPropInfo(ClassInfo, 'font') <> nil then
font.size := (NewFormWidth DIV OldFormWidth) *
font.size;
end;
end;
And now comes my problem :-) I don't get this code to work :-( I filled
constants for NewFormWidth and OldFormWidth but without any result :-( Has
someone experienced this problem before? Does someone knows a good solution
for me?
Any help will be appreciated!
Please reply to my E-Mail adress (use the adress at the bottom of this
message) as to the NG as well!
Greets Marco Craamer
M.Cr...@net.hcc.nl