LCL: TCustomSplitter.AnchorSplitter: disable autosizing

git-svn-id: trunk@36866 -
This commit is contained in:
mattias 2012-04-17 08:03:17 +00:00
parent 925be78561
commit 73fef58a27

View File

@ -525,8 +525,10 @@ begin
else else
Cursor := crVSplit; Cursor := crVSplit;
if not (csLoading in ComponentState) then if not (csLoading in ComponentState) then
begin
Align := alNone; Align := alNone;
Invalidate; Invalidate;
end;
end; end;
procedure TCustomSplitter.SetResizeControl(const AValue: TControl); procedure TCustomSplitter.SetResizeControl(const AValue: TControl);
@ -959,34 +961,39 @@ var
OldWidth: LongInt; OldWidth: LongInt;
OldHeight: LongInt; OldHeight: LongInt;
begin begin
OldWidth := Self.Width; DisableAutoSizing;
OldHeight := Self.Height; try
OldResizeAnchor := FResizeAnchor; OldWidth := Width;
Align := alNone; OldHeight := Height;
FResizeAnchor := Kind; OldResizeAnchor := FResizeAnchor;
Align := alNone;
FResizeAnchor := Kind;
if ResizeAnchor in [akLeft,akRight] then if ResizeAnchor in [akLeft,akRight] then
Cursor := crHSplit Cursor := crHSplit
else
Cursor := crVSplit;
case FResizeAnchor of
akLeft: AnchorSplitterSides(akLeft, akRight, akTop, akBottom);
akRight: AnchorSplitterSides(akRight, akLeft, akTop, akBottom);
akTop: AnchorSplitterSides(akTop, akBottom, akLeft, akRight);
akBottom: AnchorSplitterSides(akBottom, akTop, akLeft, akRight);
end;
if (OldResizeAnchor in [akLeft, akRight]) = (ResizeAnchor in [akLeft, akRight]) then
begin
// keep width and height
SetBounds(Left, Top, OldWidth, OldHeight);
end else begin
// resize
if FResizeAnchor in [akLeft, akRight] then
Width := OldHeight
else else
Height := OldWidth; Cursor := crVSplit;
case FResizeAnchor of
akLeft: AnchorSplitterSides(akLeft, akRight, akTop, akBottom);
akRight: AnchorSplitterSides(akRight, akLeft, akTop, akBottom);
akTop: AnchorSplitterSides(akTop, akBottom, akLeft, akRight);
akBottom: AnchorSplitterSides(akBottom, akTop, akLeft, akRight);
end;
if (OldResizeAnchor in [akLeft, akRight]) = (ResizeAnchor in [akLeft, akRight]) then
begin
// keep width and height
SetBounds(Left, Top, OldWidth, OldHeight);
end else begin
// resize
if FResizeAnchor in [akLeft, akRight] then
Width := OldHeight
else
Height := OldWidth;
end;
finally
EnableAutoSizing;
end; end;
end; end;