How to Create a StatusBar in a Dialog.
问题点数:50、回复次数:4Top
1 楼cloud(八大山人)回复于 2000-02-21 18:22:00 得分 0
试试照着CMainFrame::OnCreate中建StatusBar写,没试过。Top
2 楼Fancy()回复于 2000-02-21 18:25:00 得分 50
看看下面這段程序, 一定會有幫助
BOOL CModelessMain::OnInitDialog()
{
CModelessDialog::OnInitDialog();
// Create status bar at the bottom of the dialog window
if (m_statusBar.Create(this))
{
m_statusBar.SetIndicators(m_lpaIDStatusBar, m_cIDStatusBar);
OnSetMessageString(AFX_IDS_IDLEMESSAGE);
// Make a sunken or recessed border around the first pane
m_statusBar.SetPaneInfo(0, m_statusBar.GetItemID(0),
SBPS_STRETCH, NULL );
}
// Create toolbar at the top of the dialog window
if (m_toolBar.Create(this))
{
m_toolBar.LoadBitmap(m_nIDBitmap);
m_toolBar.SetButtons(m_lpaIDToolBar, m_cIDToolBar);
}
m_toolBar.SetBarStyle(m_toolBar.GetBarStyle() and
CBRS_TOOLTIPS and CBRS_FLYBY and CBRS_SIZE_DYNAMIC);
// We need to resize the dialog to make room for control bars.
// First, figure out how big the control bars are.
CRect rcClientStart;
CRect rcClientNow;
GetClientRect(rcClientStart);
RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST,
0, reposQuery, rcClientNow);
// Now move all the controls so they are in the same relative
// position within the remaining client area as they would be
// with no control bars.
CPoint ptOffset(rcClientNow.left - rcClientStart.left,
rcClientNow.top - rcClientStart.top);
CRect rcChild;
CWnd* pwndChild = GetWindow(GW_CHILD);
while (pwndChild)
{
pwndChild->GetWindowRect(rcChild);
ScreenToClient(rcChild);
rcChild.OffsetRect(ptOffset);
pwndChild->MoveWindow(rcChild, FALSE);
pwndChild = pwndChild->GetNextWindow();
}
// Adjust the dialog window dimensions
CRect rcWindow;
GetWindowRect(rcWindow);
rcWindow.right += rcClientStart.Width() - rcClientNow.Width();
rcWindow.bottom += rcClientStart.Height() - rcClientNow.Height();
MoveWindow(rcWindow, FALSE);
// And position the control bars
RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
// 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
// Finally, center the dialog on the screen
CenterWindow();
return TRUE;
}Top
3 楼xenogear()回复于 2000-02-21 18:27:00 得分 0
用CStatusBar类Top
4 楼skt642()回复于 2001-05-31 17:35:00 得分 0
18059关注!Top




