|
Limit the move area
TFormDesigner allows to limit the area where the controls can be placed. In fact, TFormDesigner just limits the mouse moving area using WinAPI ClipCursor function. By default the limit area is the client area of the moved controls' parent control. This default value is passed into the OnMoveLimit event as the LimitRect parameter. You can change the LimitRect in th event handler to change the limit area. The follow example allows to move the controls only in the left half of the parent control or form.
procedure TForm1.FormDesigner1MoveLimit(Sender: TObject;
TheControl: TControl; var LimitRect: TRect);
begin
with LimitRect do Right:=(Left+Right) div 2;
end;
|