滚动字幕为什么会闪烁?谁又不闪烁的?

解决方案 »

  1.   

    你是如何更新画面的?
    是否是每次都是通过在Timer()中Invalidate()实现窗口的重画?
    如下例中一样?
    // ttView.cpp : implementation of the CTtView class
    //#include "stdafx.h"
    #include "tt.h"#include "ttDoc.h"
    #include "ttView.h"#ifdef _DEBUG
    #define new DEBUG_NEW
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
    #endif/////////////////////////////////////////////////////////////////////////////
    // CTtViewIMPLEMENT_DYNCREATE(CTtView, CView)BEGIN_MESSAGE_MAP(CTtView, CView)
    //{{AFX_MSG_MAP(CTtView)
    ON_WM_TIMER()
    ON_COMMAND(ID_WHY, OnWhy)
    //}}AFX_MSG_MAP
    // Standard printing commands
    ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
    ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
    ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
    END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
    // CTtView construction/destructionCTtView::CTtView()
    {
    // TODO: add construction code here
    }CTtView::~CTtView()
    {
    }BOOL CTtView::PreCreateWindow(CREATESTRUCT& cs)
    {
    // TODO: Modify the Window class or styles here by modifying
    //  the CREATESTRUCT cs return CView::PreCreateWindow(cs);
    }/////////////////////////////////////////////////////////////////////////////
    // CTtView drawingvoid CTtView::OnDraw(CDC* pDC)
    {
    CTtDoc* pDoc = GetDocument();
    ASSERT_VALID(pDoc);
    // TODO: add draw code for native data here
    static int x = 0;
    x += 10;
    if(x > 500)
    x = 0;
    pDC->TextOut(x, 10, "Test OK");
    }/////////////////////////////////////////////////////////////////////////////
    // CTtView printingBOOL CTtView::OnPreparePrinting(CPrintInfo* pInfo)
    {
    // default preparation
    return DoPreparePrinting(pInfo);
    }void CTtView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
    {
    // TODO: add extra initialization before printing
    }void CTtView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
    {
    // TODO: add cleanup after printing
    }/////////////////////////////////////////////////////////////////////////////
    // CTtView diagnostics#ifdef _DEBUG
    void CTtView::AssertValid() const
    {
    CView::AssertValid();
    }void CTtView::Dump(CDumpContext& dc) const
    {
    CView::Dump(dc);
    }CTtDoc* CTtView::GetDocument() // non-debug version is inline
    {
    ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTtDoc)));
    return (CTtDoc*)m_pDocument;
    }
    #endif //_DEBUG/////////////////////////////////////////////////////////////////////////////
    // CTtView message handlersvoid CTtView::OnTimer(UINT nIDEvent) 
    {
    // TODO: Add your message handler code here and/or call default
    CTtView::Invalidate();
    CView::OnTimer(nIDEvent);
    }void CTtView::OnWhy() 
    {
    // TODO: Add your command handler code here
    SetTimer(1, 100, NULL);
    }
      

  2.   

    改成下面程序这样子。感觉上是不是能好点?
    在Timer()中实现重画。
      

  3.   

    看看这个了解原理,配合上边的程序http://expert.csdn.net/Expert/topic/1255/1255117.xml?temp=.9708368