Главная страница | назад





Article #17494: Preventing Components from Resizing

 Question and Answer Database
FAQ2494D.txt Preventing Components from Resizing
Category :VCL
Platform :All
Product :All 32 bit
Question:
How can I prevent resizing of my component at
design-time?
Answer:
Have your constructor set the default size of the object.
Override the SetBounds method, and then check the
component state. If it is in design mode (csDesigning in
ComponentState) simply pass the default values for width
and heights to the inherited SetBounds, otherwise you
pass the parameters unchanged.
Example:
procedure TVu.SetBounds(ALeft : integer;
ATop : integer;
AWidth : integer;
AHeight : integer);
begin
if csdesigning in componentstate then begin
AWidth := 50;
AHeight := 50;
inherited;
end;

7/16/98 4:31:28 PM

Last Modified: 01-SEP-99