滚动字幕为什么会闪烁?谁又不闪烁的?
解决方案 »
- 有没有用过matcom。。急求
- 本地HOOK API的列子
- 如何在TXT文件中找到指定字符和定位
- 求教阿,关于TabCtrl ,快要崩溃了~~~~~~~~~~~~~~~~~~~~帮帮我饿。。。
- mfc写ocx如何实现类似MSFlexGrid中COleFont的导出类
- 关于CListView的与右键菜单配合时出现的问题:为什么在没有ITEM的区域,单击右键,出右键菜单,点击右键菜单后,鼠标下方会出现一个框??
- 如何实现从一种图象到相似一种图象的过渡处理软件?
- 急 急 急
- 如何获得FormView的View类指针?
- 怎样好好利用大三以后的时间?
- 请问怎样显示一个自绘的光标??
- 多客户端时,当一个客户发消息,如何将此用户的消息发送到其他所有用户!
是否是每次都是通过在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);
}
在Timer()中实现重画。