NewControlsPropSheet::NewControlsPropSheet(CWnd* pParentWnd) : CMFCPropertySheet(IDS_CAPTION, pParentWnd) { //BOOL b32BitIcons = globalData.bIsOSAlphaBlendingSupport; BOOL b32BitIcons = TRUE; if (globalData.m_nBitsPerPixel == 16) { // 32-bit icons in 16 bpp display mode // are correctly displayed in WinXP only OSVERSIONINFO osvi; osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); ::GetVersionEx(&osvi); b32BitIcons = (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT && (osvi.dwMajorVersion > 5 || (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion >= 1))); } SetLook(CMFCPropertySheet::PropSheetLook_OutlookBar); SetIconsList(b32BitIcons ? IDB_ICONS32 : IDB_ICONS, 32); AddPage(&m_Page1); AddPage(&m_Page2); AddPage(&m_Page3); AddPage(&m_Page4); AddPage(&m_Page5); AddPage(&m_Page6); m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); }
//*************************************************************************************** BOOL CBCGPropertySheet::SetIconsList (UINT uiImageListResID, int cx, COLORREF clrTransparent) { ASSERT_VALID(this); LPCTSTR lpszResourceName = MAKEINTRESOURCE (uiImageListResID); ASSERT(lpszResourceName != NULL); HBITMAP hbmp = (HBITMAP) ::LoadImage ( AfxGetResourceHandle (), lpszResourceName, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION); if (hbmp == NULL) { TRACE(_T("Can't load bitmap: %x\n"), uiImageListResID); return FALSE; } CImageList icons; m_bAlphaBlendIcons = FALSE; BITMAP bmpObj; ::GetObject (hbmp, sizeof (BITMAP), &bmpObj); UINT nFlags = (clrTransparent == (COLORREF) -1) ? 0 : ILC_MASK; switch (bmpObj.bmBitsPixel) { case 4: default: nFlags |= ILC_COLOR4; break; case 8: nFlags |= ILC_COLOR8; break; case 16: nFlags |= ILC_COLOR16; break; case 24: nFlags |= ILC_COLOR24; break; case 32: nFlags |= ILC_COLOR32; m_bAlphaBlendIcons = TRUE; break; } icons.Create (cx, bmpObj.bmHeight, nFlags, 0, 0); icons.Add (CBitmap::FromHandle (hbmp), clrTransparent); SetIconsList (icons); return TRUE; }
COptionsDlg::COptionsDlg(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage) :CMFCPropertySheet(pszCaption, pParentWnd, iSelectPage) { SetLook(CMFCPropertySheet::PropSheetLook_Tree, 150 /* Tree control width */); SetIconsList(IDB_OPTIONSIMAGES, 16 /* Image width */); // <snippet23> // The second parameter is the zero based index of an icon that is displayed when // the control property page is not selected. // The third parameter is the zero based index of an icon that is displayed when // the control property page is selected. CMFCPropertySheetCategoryInfo* pCat1 = AddTreeCategory(_T("Environment"), 0, 1); // </snippet23> AddPageToTree(pCat1, &m_Page11, -1, 2); AddPageToTree(pCat1, &m_Page12, -1, 2); CMFCPropertySheetCategoryInfo* pCat2 = AddTreeCategory(_T("Source Control"), 0, 1); AddPageToTree(pCat2, &m_Page21, -1, 2); AddPageToTree(pCat2, &m_Page22, -1, 2); CMFCPropertySheetCategoryInfo* pCat3 = AddTreeCategory(_T("Text Editor"), 0, 1); AddPageToTree(pCat3, &m_Page31, -1, 2); AddPageToTree(pCat3, &m_Page32, -1, 2); }
CModelDlg::CModelDlg(CWnd* pParentWnd, UINT iSelectPage) : CMFCPropertySheet(_T("Model Editor"), pParentWnd, iSelectPage), m_generalPage(m_model), m_WGInputPage(m_model), m_SSIPage(m_model), m_inputPage(m_model), m_outputPage(m_model), m_creditPage(m_model) { m_psh.dwFlags |= PSH_NOAPPLYNOW; m_psh.dwFlags &= ~(PSH_HASHELP); //Load the icon what we will set later for the program m_hIcon = AfxGetApp()->LoadIcon(IDI_DBEDIT_MODEL); //Set look and icon SetLook(CMFCPropertySheet::PropSheetLook_OutlookBar); SetIconsList(IDB_UI_MODEL_ICONS, 48); AddPage(&m_generalPage); AddPage(&m_WGInputPage); AddPage(&m_SSIPage); AddPage(&m_inputPage); AddPage(&m_outputPage); AddPage(&m_creditPage); }
CSetupSheet::CSetupSheet(CWnd* lpParentWnd) : CMFCPropertySheet(_T("参数设置"), lpParentWnd) { SetLook(CMFCPropertySheet::PropSheetLook_OutlookBar); SetIconsList(IDB_SETUP_SHEET, 32); AddPage(&m_pageNetworkTest); AddPage(&m_pageEchoTest); AddPage(&m_pageDeviceTest); AddPage(&m_pageSetup); }
COptionsDlg::COptionsDlg(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage) :CBCGPPropertySheet(pszCaption, pParentWnd, iSelectPage) { SetLook (CBCGPPropertySheet::PropSheetLook_Tree, 150 /* Tree control width */); SetIconsList (IDB_OPTIONSIMAGES, 16 /* Image width */); CBCGPPropSheetCategory* pCat1 = AddTreeCategory (_T("Environment"), 0, 1); AddPageToTree (pCat1, &m_Page11, -1, 2); AddPageToTree (pCat1, &m_Page12, -1, 2); CBCGPPropSheetCategory* pCat2 = AddTreeCategory (_T("Source Control"), 0, 1); AddPageToTree (pCat2, &m_Page21, -1, 2); AddPageToTree (pCat2, &m_Page22, -1, 2); CBCGPPropSheetCategory* pCat3 = AddTreeCategory (_T("Text Editor"), 0, 1); AddPageToTree (pCat3, &m_Page31, -1, 2); AddPageToTree (pCat3, &m_Page32, -1, 2); }
int CTaskPane::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMFCTasksPane::OnCreate(lpCreateStruct) == -1) return -1; SetCaption (_T("Tasks Pane")); SetIconsList (IDB_TASKS, 16); EnableNavigationToolbar (TRUE); EnableWrapLabels (TRUE); EnableOffsetCustomControls (FALSE); m_nDocumentsGroup = AddGroup (_T("Open a document"), FALSE, TRUE); // Add MRU list: AddMRUFilesList (m_nDocumentsGroup); AddTask (m_nDocumentsGroup, _T("More Documents..."), 0, ID_FILE_OPEN); int nPage1Gr2 = AddGroup (_T("Custom group")); m_nUserColorGroup = nPage1Gr2; AddTask (nPage1Gr2, _T("Task 1"), 1, ID_TASK1); m_nUserColorTask = AddTask (nPage1Gr2, _T("Task 2"), 2, ID_TASK2); AddTask (nPage1Gr2, _T("Task 3"), 3, ID_TASK3); AddSeparator (nPage1Gr2); AddTask (nPage1Gr2, _T("Task 4"), 4, ID_TASK4); AddTask (nPage1Gr2, _T("Task 5"), 5, ID_TASK5); AddTask (nPage1Gr2, _T("Long task's name to see words wrap feature"), 6, ID_TASK6); int nPage1Gr3 = AddGroup (_T("Details"), TRUE); AddLabel (nPage1Gr3, _T("The Label contains text, which can be displayed in several lines. \n\nText can include line breaking characters \'\\n\' and &underline markers \'&&\'")); // Add second page: int nPage2 = AddPage (_T("Custom page")); int nPage2Gr1 = AddGroup (nPage2, _T("Tree Control")); if (!CreateTreeControl()) { TRACE0("Failed to create the custom window\n"); return -1; // fail to create } const int nControlHeight = 65; AddWindow (nPage2Gr1, m_wndTree.GetSafeHwnd (), nControlHeight); AddTask (nPage2Gr1, _T("My favorites..."), 9, ID_TASK9); int nPage2Gr2 = AddGroup (nPage2, _T("Edit Control")); if (!CreateEditControl()) { TRACE0("Failed to create the custom window\n"); return -1; // fail to create } AddWindow (nPage2Gr2, m_wndEdit.GetSafeHwnd (), nControlHeight); // Create tasks pane windows. // TODO: create your own tasks panes here: return 0; }
int CTaskPane::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMFCTasksPane::OnCreate(lpCreateStruct) == -1) return -1; SetIconsList (IDB_TASKS, 16); SetCaption (_T("Tasks Pane")); SetPageCaption (0, _T("New document")); m_nDocumentsGroup = AddGroup (_T("Open a document"), FALSE, TRUE); // Add MRU list AddMRUFilesList (m_nDocumentsGroup); AddTask (m_nDocumentsGroup, _T("More Documents..."), 0, ID_FILE_OPEN); int nPage1Gr2 = AddGroup (_T("New")); AddTask (nPage1Gr2, _T("Blank Document"), 1, ID_FILE_NEW); AddTask (nPage1Gr2, _T("Blank Web Page"), 2, ID_DUMMY); AddSeparator (nPage1Gr2); AddTask (nPage1Gr2, _T("Blank E-mail message"), 3, ID_DUMMY); int nPage1Gr3 = AddGroup (_T("New from existing document")); AddTask (nPage1Gr3, _T("Choose document..."), 4, ID_DUMMY); int nPage1Gr4 = AddGroup (_T("New from template")); AddTask (nPage1Gr4, _T("General Templates..."), 5, ID_DUMMY); AddTask (nPage1Gr4, _T("Templates on my Web Sites..."), 6, ID_DUMMY); AddTask (nPage1Gr4, _T("Templates on Microsoft.com..."), 7, ID_DUMMY); int nPage1Gr5 = AddGroup (_T(""), TRUE /* Group at bottom */); AddTask (nPage1Gr5, _T("Add Network Place..."), 8, ID_DUMMY); AddTask (nPage1Gr5, _T("Help..."), 9, ID_DUMMY); AddLabel (nPage1Gr5, _T("Label")); //-------- // Page 2: //-------- int nPage2 = AddPage (_T("Basic Search")); int nPage2Gr1 = AddGroup (nPage2, _T("Search for:")); AddTask (nPage2Gr1, _T("Search Tips..."), 9, ID_DUMMY); int nPage2Gr3 = AddGroup (nPage2, _T("See also:")); AddTask (nPage2Gr3, _T("Advanced Search"), 9, ID_DUMMY); AddTask (nPage2Gr3, _T("Find in this document..."), 9, ID_DUMMY); //-------- // Page 3: //-------- int nPage3 = AddPage (_T("Custom page")); int nPage3Gr1 = AddGroup (nPage3, _T("Folders")); if (!CreateTreeWindow()) { TRACE0("Failed to create the custom window\n"); return -1; // fail to create } AddWindow (nPage3Gr1, m_wndTree.GetSafeHwnd (), 65); AddTask (nPage3Gr1, _T("My favorites..."), 0, ID_DUMMY); int nPage3Gr2 = AddGroup (nPage3, _T("Enter your text")); CRect rectDummy; rectDummy.SetRectEmpty (); DWORD dwEditStyle = WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE | ES_WANTRETURN; m_Font.CreateStockObject (DEFAULT_GUI_FONT); if (!m_wndEdit.Create (dwEditStyle, rectDummy, this, (UINT)-1)) { TRACE0("Failed to create the edit window\n"); return -1; // fail to create } m_wndEdit.SetFont (&m_Font); m_wndEdit.SetWindowText( _T("This is the standard multiline Edit Box.\r\nHere you can type your text.")); AddWindow (nPage3Gr2, m_wndEdit.GetSafeHwnd (), 65); return 0; }
void CTaskPane::UpdateIcons () { SetIconsList (theApp.m_bHiColorIcons ? IDB_TASKS_HC : IDB_TASKS, 16); }