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

Вниз

Form.CanResize:=False и програмное изменение размеров   Найти похожие ветки 

 
Ajax ©   (2005-08-03 12:33) [0]

Почему при выставлении Form.CanResize:=False перестает работать програмное изменение размеров? IMHO CanResize должно относится только к действию пользователя. Или нет?

Если сейчас все правильно, тогда как не позволять пользователю изменять размеры, но иметь возможность делать это програмно?

Спасибо.


 
Thaddy   (2005-08-03 13:09) [1]

This is the Windows API works.
If you want to set it programmatically, you have to temporary re-enable resizing.
On some older Windows versions it may be even necessary to recreate the Window to obtain the proper result.
On Me/XP this is not necessary.

Anyway, should you need it, here's code that does this for KOL:

// Surfaces protected fields and methods outside kol.pas
type
 PHack = ^THack;
 THack = object(TControl)end;

// KOL recreatewindow, like in the VCL
// Handy for adapting WindowClass parameters like
// CS_NOCLOSE at runtime.
procedure ReCreateWindow(aControl:PControl);
begin
DestroyWindow(aControl.Getwindowhandle);
PHack(aControl).fHandle:=0;
aControl.CreateWindow;
end;


 
Ajax ©   (2005-08-03 14:36) [2]

Thank you. But what about my first question? When I set bsSingle border style in VCL, changing form"s size programatically works fine. For KOL I use temporary re-enabling resizing, but I think that it isn"t right. Also there is a visual effect of changing CanResize state. So it isn"t good method.


 
ECM ©   (2005-08-03 14:57) [3]

Form.CanResize:=TRUE
Form.Style := Form.Style and not WS_THICKFRAME;

enjoy!


 
Ajax ©   (2005-08-03 17:18) [4]

>[3] ECM ©   (03.08.05 14:57)
Спасибо! Просто дело в том, что я на автомате ставил Form.Style or not WS_THICKFRAME, когда пытался аналогично проблему решить :-)
Все вопрос закрыт.



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

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

Наверх




Память: 0.47 MB
Время: 0.051 c
2-1141672750
mrAndersen
2006-03-06 22:19
2006.03.26
Текст


2-1141940631
ColD.Handle
2006-03-10 00:43
2006.03.26
Как добавить к компоненту TColorDialog кнопку TButton?


2-1142049830
mfender
2006-03-11 07:03
2006.03.26
Редактор TStrings в Design-Time


2-1142238684
Stanislav
2006-03-13 11:31
2006.03.26
Сохранение строки в Юникоде


15-1141599465
Andy BitOff
2006-03-06 01:57
2006.03.26
Помогите понять код на С