DockedFormEditor: Prevent TForm from being aligned to parent (resize-container). Issue #39531

This commit is contained in:
Martin 2024-07-06 13:06:59 +02:00
parent 68b94f6b72
commit 835e3c2a62
2 changed files with 20 additions and 6 deletions

View File

@ -180,6 +180,13 @@ type
property PopupMenu: TPopupMenu read GetPopupMenu write SetPopupMenu;
end;
{ TResizeFormContainer }
TResizeFormContainer = class(TWinControl)
protected
procedure AlignControls(AControl: TControl; var RemainingClientRect: TRect); override;
end;
{ TResizeContainer }
TResizeContainer = class(TComponent)
@ -188,7 +195,7 @@ type
FBoundsRect: TRect;
FFakeMenu: TCustomControl;
FFormClient: TWinControl;
FFormContainer: TWinControl;
FFormContainer: TResizeFormContainer;
FParent: TWinControl;
FResizeBars: TResizeBars;
FResizeGrips: TResizeGrips;
@ -203,7 +210,7 @@ type
property BoundsRect: TRect read FBoundsRect;
property FakeMenu: TCustomControl read FFakeMenu;
property FormClient: TWinControl read FFormClient;
property FormContainer: TWinControl read FFormContainer;
property FormContainer: TResizeFormContainer read FFormContainer;
property Parent: TWinControl read FParent;
property ResizeBars: TResizeBars read FResizeBars;
property ResizeGrips: TResizeGrips read FResizeGrips;
@ -578,6 +585,13 @@ begin
FBar[7].SetBounds(ARect.Left, ARect.Top + BarSize, BarSize, LMiddleTop - ARect.Top - BarSize);
end;
{ TResizeFormContainer }
procedure TResizeFormContainer.AlignControls(AControl: TControl; var RemainingClientRect: TRect);
begin
// Do not align the form
end;
{ TResizeContainer }
constructor TResizeContainer.Create(AWinControl: TWinControl);
@ -599,7 +613,7 @@ begin
FFormClient.ControlStyle:= FFormClient.ControlStyle + [csOpaque];
FFormClient.Parent := Parent;
FFormContainer := TWinControl.Create(FFormClient);
FFormContainer := TResizeFormContainer.Create(FFormClient);
FFormContainer.Parent := FFormClient;
FAnchorContainer := TWinControl.Create(Parent);

View File

@ -60,7 +60,7 @@ type
function GetAnchorContainer: TWinControl;
function GetFakeMenu: TCustomControl;
function GetFormClient: TWinControl;
function GetFormContainer: TWinControl;
function GetFormContainer: TResizeFormContainer;
function GetSizerGripSize: Integer;
procedure RefreshAnchorDesigner;
procedure ResizeBarPaint(Sender: TObject);
@ -82,7 +82,7 @@ type
property DesignForm: TDesignForm read FDesignForm write SetDesignForm;
property FakeMenu: TCustomControl read GetFakeMenu;
property FormClient: TWinControl read GetFormClient;
property FormContainer: TWinControl read GetFormContainer;
property FormContainer: TResizeFormContainer read GetFormContainer;
property NewFormSize: TPoint read FNewFormSize;
property OnResized: TNotifyEvent read FOnResized write FOnResized;
property Resizing: Boolean read FResizing;
@ -275,7 +275,7 @@ begin
Result := FResizeContainer.FormClient;
end;
function TResizeControl.GetFormContainer: TWinControl;
function TResizeControl.GetFormContainer: TResizeFormContainer;
begin
Result := FResizeContainer.FormContainer;
end;