Skip to content

Commit

Permalink
fixed border/grip issue with child dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
ppescher committed Oct 16, 2002
1 parent fbaa66f commit 44896dd
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions ResizableLib/ResizableDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,29 @@ int CResizableDialog::OnCreate(LPCREATESTRUCT lpCreateStruct)
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;

// keep client area
CRect rect;
GetClientRect(&rect);
// set resizable style
ModifyStyle(DS_MODALFRAME, WS_POPUP | WS_THICKFRAME);
// adjust size to reflect new style
::AdjustWindowRectEx(&rect, GetStyle(),
::IsMenu(GetMenu()->GetSafeHmenu()), GetExStyle());
SetWindowPos(NULL, 0, 0, rect.Width(), rect.Height(), SWP_FRAMECHANGED|
SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREPOSITION);

// set the initial size as the min track size
SetMinTrackSize(rect.Size());
// child dialogs don't want resizable border or size grip,
// nor they can handle the min/max size constraints
BOOL bChild = GetStyle() & WS_CHILD;

if (!bChild)
{
// keep client area
CRect rect;
GetClientRect(&rect);
// set resizable style
ModifyStyle(DS_MODALFRAME, WS_POPUP | WS_THICKFRAME);
// adjust size to reflect new style
::AdjustWindowRectEx(&rect, GetStyle(),
::IsMenu(GetMenu()->GetSafeHmenu()), GetExStyle());
SetWindowPos(NULL, 0, 0, rect.Width(), rect.Height(), SWP_FRAMECHANGED|
SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREPOSITION);

// set the initial size as the min track size
SetMinTrackSize(rect.Size());
}

// create and init the size-grip
if (!CreateSizeGrip())
if (!CreateSizeGrip(!bChild))
return -1;

return 0;
Expand Down

0 comments on commit 44896dd

Please sign in to comment.