我在一个对话框表面插入了一段文字,但我想让这段文字动起来,比如飞进飞出,怎么办

解决方案 »

  1.   

    需要重载类了,呵呵,最好能重载一个CStatic类!!
      

  2.   

    对,重载一个CStatic类,看看下面这段代码看有什么启发吧
    void CMyStatic::OnPaint() 
        { 
         CPaintDC dc(this); // device context for painting 
         CRect rect; 
         GetClientRect(&rect); 
         
         CString m_strStatic; 
         CWnd* wndStatic = dc.GetWindow(); 
         wndStatic->GetWindowText(m_strStatic); 
         
         CBitmap bitmap; 
         bitmap.LoadBitmap(IDB_BACK); 
         CDC dcmem; 
         dcmem.CreateCompatibleDC(&dc); 
         CBitmap* poldbitmap = dcmem.SelectObject(&bitmap); 
         dc.BitBlt(0,0,rect.Width(),rect.Height(),&dcmem,0,0,SRCCOPY); 
         dcmem.SelectObject(poldbitmap); 
         
         dc.SetBkMode(TRANSPARENT); 
         dc.TextOut(2,2,m_strStatic); 
         // Do not call CStatic::OnPaint() for painting messages 
        }