Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2007.01.21;
Скачать: CL | DM;

Вниз

Form1.ScaleBy   Найти похожие ветки 

 
Maloric   (2006-04-08 13:14) [0]

Добрый день!
На Vcl есть функция масштабирования формы
Например:

  iPer:=Round(((ScreenWidth-800)/800)*100)+100;
  xForm.ScaleBy(iPer,100);

Есть ли в KOL что-нибудь подобное?


 
ECM ©   (2006-04-08 14:07) [1]

Нет...
Но никто не запрещает реализовать  Вам это самостоятельно
:)


 
thaddy   (2006-04-08 14:48) [2]


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:50) [3]

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:51) [4]

The first code is simpler and works if you change  ChangescaleAll to ChangeScaleSImple.


 
Maloric   (2006-04-08 15:20) [5]

Спасибо, я так и думал, просто вдруг такая функция уже есть, вот и спросил.


 
thaddy   (2006-04-08 15:27) [6]

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%



Страницы: 1 вся ветка

Текущий архив: 2007.01.21;
Скачать: CL | DM;

Наверх




Память: 0.48 MB
Время: 0.061 c
2-1167993985
DelphiLexx
2007-01-05 13:46
2007.01.21
Delphi выдает ошибку. С чем это связано


2-1167221075
harusha
2006-12-27 15:04
2007.01.21
DLL


2-1168003577
daser
2007-01-05 16:26
2007.01.21
Подкажите, как можно увидеть все коннекты к БД FireBird...


2-1167993908
sashafan
2007-01-05 13:45
2007.01.21
ListBox1 и Memo1


2-1167314886
cvg
2006-12-28 17:08
2007.01.21
не находится хэндл у самой программы