int CResizableDialog::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CDialog::OnCreate(lpCreateStruct) == -1) return -1; // 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(!bChild)) return -1; return 0; }
BOOL CResizableFormView::OnNcCreate(LPCREATESTRUCT lpCreateStruct) { if (!CFormView::OnNcCreate(lpCreateStruct)) return FALSE; // create and init the size-grip if (!CreateSizeGrip()) return FALSE; return TRUE; }
int CResizableFormView::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFormView::OnCreate(lpCreateStruct) == -1) return -1; // create and init the size-grip if (!CreateSizeGrip()) return -1; return 0; }
BOOL CResizableSheetEx::OnNcCreate(LPCREATESTRUCT lpCreateStruct) { if (!CPropertySheetEx::OnNcCreate(lpCreateStruct)) return FALSE; // child dialogs don't want resizable border or size grip, // nor they can handle the min/max size constraints BOOL bChild = lpCreateStruct->style & WS_CHILD; // create and init the size-grip if (!CreateSizeGrip(!bChild)) return FALSE; MakeResizable(lpCreateStruct); return TRUE; }
BOOL CResizableDialog::OnNcCreate(LPCREATESTRUCT lpCreateStruct) { if (!CDialog::OnNcCreate(lpCreateStruct)) return FALSE; // child dialogs don't want resizable border or size grip, // nor they can handle the min/max size constraints BOOL bChild = lpCreateStruct->style & WS_CHILD; // create and init the size-grip if (!CreateSizeGrip(!bChild)) return FALSE; if (!bChild) { // set the initial size as the min track size SetMinTrackSize(CSize(lpCreateStruct->cx, lpCreateStruct->cy)); } MakeResizable(lpCreateStruct); return TRUE; }
BOOL CMainDialog::OnInitDialog() { CDialog::OnInitDialog(); CreateSizeGrip(true); CreateToolTip(); // IDM_ABOUTBOX must be in the system command range. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX < 0xF000); // Add "About..." menu item to system menu. CMenu *pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) { CString strAboutMenu; strAboutMenu.LoadString(IDS_ABOUTBOX); if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF_SEPARATOR); pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); } } // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog. SetIcon(m_icon, TRUE); // Set big icon. SetIcon(m_icon, FALSE); // Set small icon. // Tell our Rich-Text field that it shall reflect its messages // to this dialog. I'm to lazy to make an extra subclass. m_example_text.SetEventMask(ENM_MOUSEEVENTS); m_example_text.SetWindowText(_T("Das ist ein schöner Test-Text.\n1234567890")); GetFontsList(); m_height = 50; m_weight = FW_NORMAL; m_facename = _T(""); m_combo_weight.SelectString(-1, _T("Normal")); m_combo_height.SelectString(-1, _T("50")); m_spin_weight.SetBuddy(&m_combo_weight); m_spin_height.SetBuddy(&m_combo_height); if (m_fonts_list.GetCount() > 0) { m_fonts_list.SetCurSel(0); // Select first font in list. OnLbnSelchangeFontsList(); } AddToolTips(); m_tooltip.AddTool(this, _T("TEST")); m_tooltip.AddTool(GetDlgItem(IDOK), _T("OKAY")); return TRUE; // Return TRUE, unless you set the focus to a control. }