![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Form1.ScaleBy [D6, WinXp Sp1]
Maloric © (2006-04-08 13:14:00)Добрый день!
На Vcl есть функция масштабирования формы
Например:
iPer:=Round(((ScreenWidth-800)/800)*100)+100;
xForm.ScaleBy(iPer,100);
Есть ли в KOL что-нибудь подобное?
thaddy (2006-04-08 15:27:00) [1]Yes, I knwo. I have written it;) And I have posted it before.
For completeness M = muliplier D = divisor, so ChangeSCaleSimple(Form1,75,100); Scales to 75%
Maloric (2006-04-08 15:20:00) [2]Спасибо, я так и думал, просто вдруг такая функция уже есть, вот и спросил.
thaddy (2006-04-08 14:51:00) [3]The first code is simpler and works if you change ChangescaleAll to ChangeScaleSImple.
thaddy (2006-04-08 14:50:00) [4]Sorry, here's the proper code:
type
TScalingFlags = set of (sfLeft, sfTop, sfWidth, sfHeight, sfFont);
procedure ChangeScale(Control:Pcontrol; M, D: integer; Flags:TScalingFlags =[sfLeft,sfTop, sfWidth, sfHeight, sfFont]; RecurseChildren:boolean=true);
var
X, Y, W, H, I: integer;
begin
if M <> D then
with Control^ do
begin
if RecurseChildren then
if Childcount > 0 then
for i:=0 to pred(childcount) do
Changescale(Children[i],M,D);
if sfLeft in Flags then
X := MulDiv(Left, M, D) else
X := Left;
if sfTop in Flags then
Y := MulDiv(Top, M, D) else
Y := Top;
if sfWidth in Flags then
if sfLeft in Flags then
W := MulDiv(Left + Width, M, D) else
W := MulDiv(Width, M, D)
else W := Width;
if sfHeight in Flags then
if sfHeight in Flags then
H := MulDiv(Top + Height, M, D) else
H := MulDiv(Top, M, D )
else H := Height;
BoundsRect:=Makerect(X, Y, W, H);
if sfFont in Flags then
Font.Fontheight:= MulDiv(Font.FontHeight, M, D);
end;
end;
procedure ChangeScaleSimple(Control:Pcontrol; M, D: integer);
var
X, Y, W, H, I: integer;
R:trect;
begin
if M <> D then
with Control^ do
begin
if Childcount > 0 then
for i:=0 to pred(childcount) do
ChangescaleAll(Children[i],M,D);
R:=Boundsrect;
X := MulDiv(r.Left, M, D);
Y := MulDiv(r.Top, M, D);
W := MulDiv(r.right, M, D);
H := MulDiv(r.bottom, M, D);
Boundsrect:=Makerect(x,y,w,h);
Font.FontHeight := MulDiv(Font.FontHeight, M, D);
end;
end;
thaddy (2006-04-08 14:48:00) [5]
procedure ChangeScaleSimple(Control:Pcontrol; M, D: integer);
var
X, Y, W, H, I: integer;
R:trect;
begin
if M <> D then
with Control^ do
begin
if Childcount > 0 then
for i:=0 to pred(childcount) do
ChangescaleAll(Children[i],M,D);
R:=Boundsrect;
X := MulDiv(r.Left, M, D);
Y := MulDiv(r.Top, M, D);
W := MulDiv(r.right, M, D);
H := MulDiv(r.bottom, M, D);
Boundsrect:=Makerect(x,y,w,h);
Font.FontHeight := MulDiv(Font.FontHeight, M, D);
end;
end;
ECM (2006-04-08 14:07:00) [6]Нет...
Но никто не запрещает реализовать Вам это самостоятельно
:)