Skip to content

Commit

Permalink
fixed "Freeze" buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
ppescher committed Oct 5, 2001
1 parent c715710 commit d658e8f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
28 changes: 19 additions & 9 deletions ResizableFormViewMDI/DemoView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ void CDemoView::DoDataExchange(CDataExchange* pDX)
//}}AFX_DATA_MAP
}

BOOL CDemoView::PreCreateWindow(CREATESTRUCT& cs)
{
return CResizableFormView::PreCreateWindow(cs);
}

void CDemoView::OnInitialUpdate()
{
AddAnchor(IDC_EDIT1, TOP_LEFT, CSize(40,100));
Expand Down Expand Up @@ -95,14 +90,29 @@ CDemoDoc* CDemoView::GetDocument() // non-debug version is inline

void CDemoView::OnButton2()
{
CWnd* pParent = GetParent();
CRect rect;
GetTotalClientRect(&rect);
DWORD style = pParent->GetStyle() & ~WS_THICKFRAME | WS_DLGFRAME;
::AdjustWindowRect(&rect, style, ::IsMenu(pParent->GetMenu()->m_hMenu));
// ever wanted a real dialog?
ModifyStyleEx(WS_EX_CLIENTEDGE, 0, SWP_FRAMECHANGED);
GetParent()->ModifyStyle(WS_THICKFRAME, WS_DLGFRAME, SWP_FRAMECHANGED);
ModifyStyleEx(WS_EX_CLIENTEDGE, 0);
pParent->ModifyStyle(WS_THICKFRAME, WS_DLGFRAME);
pParent->SetWindowPos(NULL, 0, 0, rect.Width(), rect.Height(),
SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_FRAMECHANGED);
}

void CDemoView::OnButton1()
{
CWnd* pParent = GetParent();
CRect rect;
GetTotalClientRect(&rect);
DWORD style = pParent->GetStyle() & ~WS_DLGFRAME | WS_THICKFRAME|WS_CAPTION;
::AdjustWindowRectEx(&rect, style, ::IsMenu(pParent->GetMenu()->m_hMenu),
WS_EX_CLIENTEDGE);
// go back to formview
ModifyStyleEx(0, WS_EX_CLIENTEDGE, SWP_FRAMECHANGED);
GetParent()->ModifyStyle(WS_DLGFRAME, WS_THICKFRAME|WS_CAPTION, SWP_FRAMECHANGED);
ModifyStyleEx(0, WS_EX_CLIENTEDGE);
pParent->ModifyStyle(WS_DLGFRAME, WS_THICKFRAME|WS_CAPTION);
pParent->SetWindowPos(NULL, 0, 0, rect.Width(), rect.Height(),
SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_FRAMECHANGED);
}
1 change: 0 additions & 1 deletion ResizableFormViewMDI/DemoView.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class CDemoView : public CResizableFormView
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDemoView)
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual void OnInitialUpdate(); // called first time after construct
Expand Down

0 comments on commit d658e8f

Please sign in to comment.