1. Add a menu bar
1. You can add the Dialog attribute directly. Property-> Menu ID.
2. Add code:
CMenu m_menu;
M_menu.LoadMenu (IDR_MENU1); // IDR_MENU1 menu ID
// Set the current menu
SetMenu (& m_menu );
2. Add the status bar
CStatusBarCtrl * m_StatBar = new CStatusBarCtrl;
RECT m_Rect;
GetClientRect (& m_Rect); // obtain the rectangular area of the dialog box.
M_rect.top = m_Rect.bottom-20; // set the rectangular area of the status bar
M_statbar-> Create (ws_border | ws_visible | cbrs_bottom, m_rect, this, 3 );
Int nparts [3] = {0.2 * m_rect.right, 0.8 * m_rect.right, m_rect.right}; // split size
M_statbar-> setparts (3, nparts); // split the status bar
M_statbar-> settext (L "status: distributing items",); // Add "This is the first indicator" to the first column"
M_statbar-> settext (L "this is the second indicator",); // The following is similar
M_statbar-> settext (L "this is the third indicator", 2, 0); // The following is similar
M_statbar-> showwindow (sw_show );
3. Add a toolbar
Ctoolbar m_wndtoolbar;
If (! M_wndtoolbar.createex (this, tbstyle_flat, ws_child | ws_visible | cbrs_align_top | cbrs_gripper | cbrs_tooltips,
Crect (,) |! M_wndtoolbar.loadtoolbar (idr_toolbar1) // toolbar ID
{
Trace0 ("failed to create toolbar/N ");
Return false;
}
M_wndtoolbar.showwindow (sw_show );
Repositionbars (afx_idw_controlbar_first, afx_idw_controlbar_last, 0 );
4. Full Screen
Int nheight, nwidth;
Nheight = getsystemmetrics (sm_cyscreen );
// NHeight = GetSystemMetrics (SM_CYSCREEN)-GetSystemMetrics (SM_CYSIZE); // The height is lower than the full screen height.
NWidth = GetSystemMetrics (SM_CXSCREEN );
MoveWindow (, nWidth, nHeight); // sets the position and size of the Dialog display.
Note: To pre-display full screen, set the Dialog attribute: Border-> None, Style-> Popup.
Additional: Dialog determines the control position
CWnd * pWnd = NULL;
// Set the location of the log Group
PWnd = GetDlgItem (IDC_LIST_TEAM); // Control ID: IDC_LIST_TEAM
ASSERT (pWnd! = NULL );
PWnd-> MoveWindow (10, 10, 200,680); // sets the display position of the control.