在Static Text控件上,实现字符串从右到左的滚动显示问题?哪位帮我看一下,有代码?
如题:
问题:显示后的轨迹没有刷新,有尾巴....哪位兄弟,帮我指点下!谢谢!
1、在基于对话框的界面上,加一个 Static Text控件,生成一个相应的控件对象ctrlInfo。
2、int x;
3、
BOOL CDlgTestDlg::OnInitDialog()
{
CDialog::OnInitDialog();
.....
// TODO: Add extra initialization here
CRect re;
m_ctrlInfo.GetClientRect(&re);
x= re.Width()-2;
SetTimer(1,1000,NULL);
return TRUE; // return TRUE unless you set the focus to a control
}
void CDlgTestDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
CDC* pDc = m_ctrlInfo.GetDC();
CRect re;
m_ctrlInfo.GetClientRect(&re);
m_ctrlInfo.ScreenToClient(&re);
pDc->TextOut(x,0,"hi,hello!abcdefghigklmnopqrstuvwxyz!");
x -= 50;
//m_ctrlInfo.Invalidate(FALSE);//InvalidateRect(&re);
if(x<0)
x=re.Width();
CDialog::OnTimer(nIDEvent);
}