如题。大放血!50分!想用VC实现像网页中文字移动(滚动)的效果。还有文字由正在播放(开启)的文件决定。即读取文件信息出现在固定的显示栏。
解决方案 »
- 去除CMFCOutLookBar的右键菜单
- 怎么样能在键盘有输入时显示一张图片而没有输入时显示另一张
- 问个简单的问题
- 用GDI画出的图像如何保存啊?
- 看代码
- 欲使用sendmessage函数,发送“ON_UPDATE_COMMAND_UI”更新工具条按钮消息,但忘了对应的消息名是什么?也就是sendmessage的第二个参数
- 我在用CList链表时,提示没有初始化,应该怎么做?
- csdn的朋友们怎么关键时刻不帮忙呀,100分求救
- ADO智能指针的两种使用格式中哪个最好,为什么?
- 怎样给菜单项前加图标?
- 道简单的DLL题目,几乎难倒了所有C++高手!!!!! (加分版)
- 向各位请假:在Listcontrol中怎么才能够实现report格式的改变标题头的名字
http://www.codeguru.com/Cpp/controls/staticctrl/article.php/c2903/
{
// TODO: Add your message handler code here and/or call default
CString strText;
GetWindowText(strText);
if (strText == m_strText)
{
CDC* pDC = GetDC();
pDC->SelectObject(&m_font);
CSize size = pDC->GetTextExtent(strText);
ReleaseDC(pDC);
CRect rect;
GetClientRect(rect);
int iWidth = rect.Width();
if (size.cx > iWidth)
{ Invalidate();
UpdateWindow();
m_iExtend += 2;
if (m_iExtend > size.cx)
m_iExtend -= size.cx + 8;
}
}
else
{
m_iExtend = 0;
m_strText = strText;
}
CStatic::OnTimer(nIDEvent);
}
void CMyStatic::OnPaint()
{
// TODO: Add your message handler code here
CPaintDC dc(this);
CRect rc;
GetClientRect(rc);
CString strText;
GetWindowText(strText);
CDC memDC;
memDC.CreateCompatibleDC(&dc);
CBitmap bmp;
bmp.CreateCompatibleBitmap(&dc, rc.Width(), rc.Height());
memDC.SelectObject(&bmp);
memDC.SelectObject(&m_font);
dc.SelectObject(&m_font);
memDC.FillSolidRect(rc, RGB(255, 255, 255);
CSize size = memDC.GetTextExtent(strText);
if (size.cx > rc.Width())
{
if (size.cx - m_iExtend > 0)
memDC.TextOut(rc.left - m_iExtend, rc.top + (rc.Height() - size.cy)/2, strText);
if (rc.left - m_iExtend + 8 +size.cx < rc.right)
memDC.TextOut(rc.left - m_iExtend + 8+size.cx , rc.top + (rc.Height() - size.cy)/2, strText);
}
else
memDC.TextOut(rc.left, rc.top + (rc.Height() - size.cy)/2, strText);
dc.BitBlt(rc.left, rc.top, rc.Width(), rc.Height(), &memDC, rc.left, rc.top, SRCCOPY);
memDC.DeleteDC();
bmp.DeleteObject();
}