lcl: ignore BorderStyle changes for TForm during the design time (issue #0017099)

git-svn-id: trunk@26993 -
This commit is contained in:
paul 2010-08-03 11:55:11 +00:00
parent 5256b68374
commit 83e5f75727
2 changed files with 19 additions and 17 deletions

View File

@ -1677,7 +1677,6 @@ var
AdaptBorderIcons: boolean; AdaptBorderIcons: boolean;
begin begin
if FFormBorderStyle = NewStyle then exit; if FFormBorderStyle = NewStyle then exit;
//TODO: Finish SETBORDERSTYLE
// AutoScroll is only available for bsSizeable, bsSizeToolWin windows // AutoScroll is only available for bsSizeable, bsSizeToolWin windows
if not (NewStyle in BorderStylesAllowAutoScroll) then if not (NewStyle in BorderStylesAllowAutoScroll) then
@ -1687,6 +1686,8 @@ begin
(BorderIcons = DefaultBorderIcons[FFormBorderStyle]); (BorderIcons = DefaultBorderIcons[FFormBorderStyle]);
FFormBorderStyle := NewStyle; FFormBorderStyle := NewStyle;
if not (csDesigning in ComponentState) then
begin
// if Form had default border icons before change, it should keep the default // if Form had default border icons before change, it should keep the default
if AdaptBorderIcons then if AdaptBorderIcons then
BorderIcons := DefaultBorderIcons[FFormBorderStyle]; BorderIcons := DefaultBorderIcons[FFormBorderStyle];
@ -1701,6 +1702,7 @@ begin
Perform(CM_ICONCHANGED, 0, 0); Perform(CM_ICONCHANGED, 0, 0);
UpdateMenu; UpdateMenu;
end; end;
end;
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------

View File

@ -371,7 +371,7 @@ begin
pClassName := @ClsName[0]; pClassName := @ClsName[0];
WindowTitle := StrCaption; WindowTitle := StrCaption;
AdjustFormBounds(lForm, Bounds); AdjustFormBounds(lForm, Bounds);
if lForm.Position in [poDefault, poDefaultPosOnly] then if (lForm.Position in [poDefault, poDefaultPosOnly]) and not (csDesigning in lForm.ComponentState) then
begin begin
Left := CW_USEDEFAULT; Left := CW_USEDEFAULT;
Top := CW_USEDEFAULT; Top := CW_USEDEFAULT;
@ -381,7 +381,7 @@ begin
Left := Bounds.Left; Left := Bounds.Left;
Top := Bounds.Top; Top := Bounds.Top;
end; end;
if lForm.Position in [poDefault, poDefaultSizeOnly] then if (lForm.Position in [poDefault, poDefaultSizeOnly]) and not (csDesigning in lForm.ComponentState) then
begin begin
Width := CW_USEDEFAULT; Width := CW_USEDEFAULT;
Height := CW_USEDEFAULT; Height := CW_USEDEFAULT;
@ -401,12 +401,12 @@ begin
end; end;
SetStdBiDiModeParams(AWinControl, Params); SetStdBiDiModeParams(AWinControl, Params);
// create window // create window
FinishCreateWindow(AWinControl, Params, false); FinishCreateWindow(AWinControl, Params, False);
Result := Params.Window; Result := Params.Window;
// remove system menu items for bsDialog // remove system menu items for bsDialog
if lForm.BorderStyle = bsDialog then if (lForm.BorderStyle = bsDialog) and not (csDesigning in lForm.ComponentState) then
begin begin
SystemMenu := GetSystemMenu(Result, False); SystemMenu := GetSystemMenu(Result, False);
DeleteMenu(SystemMenu, SC_RESTORE, MF_BYCOMMAND); DeleteMenu(SystemMenu, SC_RESTORE, MF_BYCOMMAND);