From 44896ddf7bf653705596a03481df8704f0f925cc Mon Sep 17 00:00:00 2001 From: ppescher Date: Wed, 16 Oct 2002 00:51:08 +0000 Subject: [PATCH] fixed border/grip issue with child dialogs --- ResizableLib/ResizableDialog.cpp | 35 +++++++++++++++++++------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/ResizableLib/ResizableDialog.cpp b/ResizableLib/ResizableDialog.cpp index 0ba6cb8..3e35040 100644 --- a/ResizableLib/ResizableDialog.cpp +++ b/ResizableLib/ResizableDialog.cpp @@ -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;