BOOL CDemoDlg::OnInitDialog() { CResizableDialog::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon // preset layout AddAnchor(IDOK, BOTTOM_RIGHT); AddAnchor(IDCANCEL, BOTTOM_RIGHT); AddAnchor(IDC_SPIN1, TOP_RIGHT); AddAnchor(IDC_LABEL1, TOP_LEFT); AddAnchor(IDC_EDIT1, TOP_LEFT, BOTTOM_RIGHT); AddAnchor(IDC_GROUP1, BOTTOM_LEFT, BOTTOM_RIGHT); AddAnchor(IDC_RADIO1, BOTTOM_LEFT); AddAnchor(IDC_RADIO2, BOTTOM_LEFT); // other initializations // grip is visible by default CheckRadioButton(IDC_RADIO1, IDC_RADIO2, IDC_RADIO2); GetDlgItem(IDC_RADIO2)->SetFocus(); SetDlgItemText(IDC_EDIT1, _T("CResizableDialog\r\n\r\n") _T("This dialog can be resized to full width and half the height of the screen.\r\n") _T("The minimum size is by default the one in the dialog editor.\r\n") _T("Size grip can be switched off.\r\n\r\n") _T("Try to maximize and then to restore the dialog!\r\n") _T("Isn't it cool?")); // min/max size settings // get desktop size CRect rc; GetDesktopWindow()->GetClientRect(&rc); // set max tracking size to half a screen SetMaxTrackSize(CSize(rc.Width(), rc.Height()/2)); // maximized position and size on top of the screen rc.bottom = 100; SetMaximizedRect(rc); // save/restore // (for dialog based app, default is a .INI file with // the application's name in the Windows directory) EnableSaveRestore(_T("DemoDlg")); return FALSE; // return TRUE unless you set the focus to a control }
BOOL COpenDlg::OnInitDialog() { __super::OnInitDialog(); UpdateData(FALSE); CRecentFileList& MRU = AfxGetCurrentSettings().MRU; MRU.ReadList(); m_mrucombo.ResetContent(); for(int i = 0; i < MRU.GetSize(); i++) if(!MRU[i].IsEmpty()) m_mrucombo.AddString(MRU[i]); CorrectComboListWidth(m_mrucombo, GetFont()); CRecentFileList& MRUDub = AfxGetCurrentSettings().MRUDub; MRUDub.ReadList(); m_mrucombo2.ResetContent(); for(int i = 0; i < MRUDub.GetSize(); i++) if(!MRUDub[i].IsEmpty()) m_mrucombo2.AddString(MRUDub[i]); CorrectComboListWidth(m_mrucombo2, GetFont()); if(m_mrucombo.GetCount() > 0) { m_mrucombo.SetCurSel(0); } AddAnchor(m_mrucombo, TOP_LEFT, TOP_RIGHT); AddAnchor(m_mrucombo2, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_BUTTON1, TOP_RIGHT); AddAnchor(IDC_BUTTON2, TOP_RIGHT); AddAnchor(IDOK, TOP_RIGHT); AddAnchor(IDCANCEL, TOP_RIGHT); AddAnchor(IDC_STATIC1, TOP_LEFT, TOP_RIGHT); CRect r; GetWindowRect(r); CSize s = r.Size(); SetMinTrackSize(s); s.cx = 1000; SetMaxTrackSize(s); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL CConvertChapDlg::OnInitDialog() { __super::OnInitDialog(); AddAnchor(IDC_EDIT1, TOP_LEFT); AddAnchor(IDC_EDIT2, TOP_LEFT, TOP_RIGHT); AddAnchor(IDOK, BOTTOM_CENTER); AddAnchor(IDCANCEL, BOTTOM_CENTER); CRect r; GetWindowRect(r); CSize s = r.Size(); SetMinTrackSize(s); s.cx = 1000; SetMaxTrackSize(s); UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void COFSNcDlg2::LoadSkin() { CComPtr<IXMLDOMDocument> pDoc = NULL; CComPtr<IXMLDOMNode> pRoot = NULL; LoadSkinXML(&pDoc, &pRoot); if(pRoot) { CRect r, rMin, rMax; r.SetRectEmpty(); rMin.SetRectEmpty(); rMax.SetRectEmpty(); LoadWindow(pRoot, r, rMin, rMax); // SetWindowPos(NULL, r.left, r.top, r.Width(), r.Height(), SWP_NOZORDER); LoadColors(pRoot); LoadPictures(pRoot); LoadSkin(pRoot); SetMinTrackSize(rMin.Size()); if(!rMax.IsRectEmpty()) SetMaxTrackSize(rMax.Size()); } }
BOOL COpenDlg::OnInitDialog() { __super::OnInitDialog(); AppSettings& s = AfxGetAppSettings(); CRecentFileList& MRU = s.MRU; MRU.ReadList(); m_mrucombo.ResetContent(); for (int i = 0; i < MRU.GetSize(); i++) if (!MRU[i].IsEmpty()) { m_mrucombo.AddString(MRU[i]); } CorrectComboListWidth(m_mrucombo); CRecentFileList& MRUDub = s.MRUDub; MRUDub.ReadList(); m_mrucombo2.ResetContent(); for (int i = 0; i < MRUDub.GetSize(); i++) if (!MRUDub[i].IsEmpty()) { m_mrucombo2.AddString(MRUDub[i]); } CorrectComboListWidth(m_mrucombo2); if (m_mrucombo.GetCount() > 0) { m_mrucombo.SetCurSel(0); } if (::IsClipboardFormatAvailable(CF_UNICODETEXT) && ::OpenClipboard(m_hWnd)) { HGLOBAL hglb = ::GetClipboardData(CF_UNICODETEXT); if (hglb) { LPCTSTR pText = (LPCTSTR)::GlobalLock(hglb); if (pText) { if (AfxIsValidString(pText)) { CString tmpData(CString(pText).MakeLower()); if (PlayerYouTubeCheck(tmpData) || PlayerYouTubePlaylistCheck(tmpData)) { m_mrucombo.SetWindowTextW(pText); } } GlobalUnlock(hglb); } } CloseClipboard(); } m_fns.RemoveAll(); m_path.Empty(); m_path2.Empty(); m_fMultipleFiles = false; m_fAppendPlaylist = FALSE; AddAnchor(m_mrucombo, TOP_LEFT, TOP_RIGHT); AddAnchor(m_mrucombo2, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_BUTTON1, TOP_RIGHT); AddAnchor(IDC_BUTTON2, TOP_RIGHT); AddAnchor(IDOK, TOP_RIGHT); AddAnchor(IDCANCEL, TOP_RIGHT); AddAnchor(IDC_STATIC1, TOP_LEFT, TOP_RIGHT); CRect r; GetWindowRect(r); CSize sr = r.Size(); SetMinTrackSize(sr); sr.cx = 1000; SetMaxTrackSize(sr); if (m_hIcon != NULL) { CStatic *pStat = (CStatic*)GetDlgItem(IDC_MAINFRAME_ICON); pStat->SetIcon(m_hIcon); } return TRUE; }