Jump to content
Hafedh TRIMECHE

Disable control resizing at design time.

Recommended Posts

Is there a way to disable control resizing at design time?

 

I tried this but Message.Result is always set to 1 (HTCLIENT)

procedure TUFrame.WMNCHitTest(var Message:TWMNCHitTest);
begin
  inherited;
  if Message.Result in [HTLEFT,HTRIGHT,HTBOTTOM,HTBOTTOMRIGHT,HTBOTTOMLEFT,HTTOP,HTTOPRIGHT,HTTOPLEFT] then Message.Result := Windows.HTNOWHERE;
end;

 

Thanks.

Share this post


Link to post

First there is the Lock Controls feature of the IDE, which prohibits any position or size changes during design for all controls.

 

If we are talking about some specific controls made by yourself and registered in some design time package, you can override CanResize and return False when in design mode.

 

  function CanResize(var NewWidth, NewHeight: Integer): Boolean; override;

...

function TMyControl.CanResize(var NewWidth, NewHeight: Integer): Boolean;
begin
  if csDesigning in CompontentState then
    Result := False
  else
    Result := inherited CanResize(NewWidth, NewHeight);
end;

 

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×