Главная страница
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.071 c
15-1166914973
Denisich
2006-12-24 02:02
2007.01.21
Установка acs24


2-1167272052
Roma L
2006-12-28 05:14
2007.01.21
Проблема с Ado


15-1167750310
fromthemoon
2007-01-02 18:05
2007.01.21
подобные форумы


15-1167083250
Footballer
2006-12-26 00:47
2007.01.21
Прикол от Bornald


3-1162116820
Гоблин
2006-10-29 13:13
2007.01.21
Двоичные данные в базу.