Тема: ScaleBy
Показать сообщение отдельно
  #2  
Старый 25.03.2012, 22:49
nixel nixel вне форума
Начинающий
 
Регистрация: 12.12.2011
Адрес: Москва
Сообщения: 150
Версия Delphi: XE2-U4
Репутация: 131
По умолчанию

Неправильно используете функцию ScaleBy. Смотрим справку -

Цитата:
procedure ScaleBy(M, D: Integer);

Rescale control and its children.

ScaleBy resizes a control without moving its upper left corner. This is similar to changing the Height and Width properties, but the control also attempts to rescale and rearrange any child controls to maintain their relative size and placement.

The M and D parameters define a multiplier and divisor by which to scale the control. For example, to make a control 75% of its original size, specify the value of M as 75, and the value of D as 100. Any pair of values that has the same ratio has the same effect. Thus M = 3 and D = 4 also makes the control 75% of its previous size.

В Вашем случае подойдет использование метода SetBounds для панели - panel1.SetBounds(0, 0, w, h);
Из справки:

Цитата:
procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override;


Sets the windowed control's boundary properties all at once.

Use SetBounds to change all of the control's boundary properties at once. The same effect can be achieved by setting the Left, Top, Width, and Height properties separately. By setting all four properties at once, SetBounds ensures that the control will not repaint between changes

Specify the values for the Left, Top, Width, and Height properties as the value of the ALeft, ATop, AWidth, and AHeight parameters, respectively.

На заметку, для формы так же можно вызвать SetBounds. Причем в данном случае с теми же параметрами, что и для панели. Т.е. SetBounds(0, 0, w, h);
Ответить с цитированием