Alpha_AI
asked on
I can scale my application smaller, but now i want to go to a bigger scale and then back my normal scale
I have am trying scaling my application, make it smaller, normal size, bigger and back to normal size again
well thats what im trying to achieve but my code isnt working properly.
It can go smaller, but it cant go bigger or back to the original size. Could someone look at it?
var
CurrentScreenWidth := Screen.Width;
CurrentScreenHeight := Screen.Height;
OriginalScreenWidth := Screen.Width;
OriginalScreenHeight := Screen.Height;
Procedure TForm1.Smaller1Click(Sende r: TObject);
begin
CurrentScreenWidth := CurrentScreenWidth + 100;
CurrentScreenHeight := CurrentScreenHeight + 100;
Form1.ScaleForm(Form1,Curr entScreenW idth,Curre ntScreenHe ight);
end;
procedure TForm1.ScaleForm(F: TForm; ScreenWidth, ScreenHeight: Integer);
begin
F.Scaled := True;
F.AutoScroll := False;
F.Position := poScreenCenter;
F.Font.Name := 'Arial';
if (Screen.Width <> ScreenWidth) then begin
F.Height :=
LongInt(F.Height) * LongInt(Screen.Height)
div ScreenHeight;
F.Width :=
LongInt(F.Width) * LongInt(Screen.Width)
div ScreenWidth;
F.ScaleBy(Screen.Width,Scr eenWidth) ;
end;
if (Screen.Width = ScreenWidth) then begin
F.Height :=
LongInt(F.Height) * LongInt(Screen.Height)
div ScreenHeight;
F.Width :=
LongInt(F.Width) * LongInt(Screen.Width)
div ScreenWidth;
F.ScaleBy(Screen.Width,Scr eenWidth) ;
end;
end;
Procedure TForm1.Bigger1Click(Sender : TObject);
begin
CurrentScreenWidth := CurrentScreenWidth - 100;
CurrentScreenHeight := CurrentScreenHeight - 100;
Form1.ScaleForm(Form1,Curr entScreenW idth,Curre ntScreenHe ight);
end;
How do I go smaller and bigger and back to the original size again.
If i go smaller that works, but if i go bigger it keep going smaller.
Weird?
Ben
well thats what im trying to achieve but my code isnt working properly.
It can go smaller, but it cant go bigger or back to the original size. Could someone look at it?
var
CurrentScreenWidth := Screen.Width;
CurrentScreenHeight := Screen.Height;
OriginalScreenWidth := Screen.Width;
OriginalScreenHeight := Screen.Height;
Procedure TForm1.Smaller1Click(Sende
begin
CurrentScreenWidth := CurrentScreenWidth + 100;
CurrentScreenHeight := CurrentScreenHeight + 100;
Form1.ScaleForm(Form1,Curr
end;
procedure TForm1.ScaleForm(F: TForm; ScreenWidth, ScreenHeight: Integer);
begin
F.Scaled := True;
F.AutoScroll := False;
F.Position := poScreenCenter;
F.Font.Name := 'Arial';
if (Screen.Width <> ScreenWidth) then begin
F.Height :=
LongInt(F.Height) * LongInt(Screen.Height)
div ScreenHeight;
F.Width :=
LongInt(F.Width) * LongInt(Screen.Width)
div ScreenWidth;
F.ScaleBy(Screen.Width,Scr
end;
if (Screen.Width = ScreenWidth) then begin
F.Height :=
LongInt(F.Height) * LongInt(Screen.Height)
div ScreenHeight;
F.Width :=
LongInt(F.Width) * LongInt(Screen.Width)
div ScreenWidth;
F.ScaleBy(Screen.Width,Scr
end;
end;
Procedure TForm1.Bigger1Click(Sender
begin
CurrentScreenWidth := CurrentScreenWidth - 100;
CurrentScreenHeight := CurrentScreenHeight - 100;
Form1.ScaleForm(Form1,Curr
end;
How do I go smaller and bigger and back to the original size again.
If i go smaller that works, but if i go bigger it keep going smaller.
Weird?
Ben
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.