想在状态栏显示线条数量void CMyDrawView::OnDraw(CDC* pDC)
{
CMyDrawDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
int nIndex=pDoc->GetNumLines();
Num=pDoc->GetNumLines();
TRACE("nIndex1=%d\n",nIndex);
while(nIndex--)
{
TRACE("nIndex2=%d\n",nIndex);
pDoc->GetLine(nIndex)->DrawLine(pDC);
}
CString strLines;
CStatusBar *pStatus=(CStatusBar *)AfxGetApp()->m_pMainWnd->GetDescendantWindow(ID_VIEW_STATUS_BAR);
if(pStatus)
{
strLines.Format("线条:%d",Num);
pStatus->SetPaneText(1,strLines);
}
}看看我哪里该怎么改一下啊????
{
CMyDrawDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
int nIndex=pDoc->GetNumLines();
Num=pDoc->GetNumLines();
TRACE("nIndex1=%d\n",nIndex);
while(nIndex--)
{
TRACE("nIndex2=%d\n",nIndex);
pDoc->GetLine(nIndex)->DrawLine(pDC);
}
CString strLines;
CStatusBar *pStatus=(CStatusBar *)AfxGetApp()->m_pMainWnd->GetDescendantWindow(ID_VIEW_STATUS_BAR);
if(pStatus)
{
strLines.Format("线条:%d",Num);
pStatus->SetPaneText(1,strLines);
}
}看看我哪里该怎么改一下啊????
ID_INDICATOR_TIME);显示: m_MyTimeAndLogin.SetPaneText( 0,str );
m_MyTimeAndLogin.Invalidate();
定义结构体static UINT BASED_CODE indicators[] =
{
ID_INDICATOR_TIME,
ID_INDICATOR_NISH
};
Resource.h#define ID_INDICATOR_TIME 109
#define IDR_MAINFRAME 128
pStatus->SetPaneText(0,strLines);
吧
问题解决如下:
修改
static UINT indicators[] =
{
ID_SEPARATOR, // 状态行指示器
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};这是默认为的,你应该把上面的ID分别改成你自己在String Table定义的ID才行。这个结构体在 MainFrm.cpp 中.如果不明白的话你就去这里看一下吧:http://topic.csdn.net/t/20021212/11/1253911.html应该是没有问题的了.我已经试过了.