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

View File

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