帮帮忙啊

解决方案 »

  1.   

    textout就可以实现,每次timer都刷新一下,然后在新的地方输出就可以了
      

  2.   

    我写过的段代码char str[]="asdfasdfadsfa"; DWORD time=0; 
        HDC  Dlghdc=GetDC(parent);//获得窗口的设备描述句柄
     UINT position=200,newpos=25;//文字位置
      while ( newpos < 200)
      {if (GetTickCount() - time >10)
      {   position--;
      SetTextColor(Dlghdc,RGB(255,0,1));
       TextOut(Dlghdc,75,position,(LPCTSTR)str,strlen(str));
       SetBkColor(Dlghdc,TRANSPARENT);//TRANSPARENT
                                UpdateWindow(parent);
        ReleaseDC(parent, Dlghdc);
        newpos++;
        time=GetTickCount();
        ReleaseCapture();
      }} 
      

  3.   

    Scrolling Banners -- the MFC Way --------------------------------------------------------------------------------
    This article was contributed by Paul Wendt. 
     Have you ever wanted to have a control on one of your applications that behaves like some of those internet banners? You'll have a banner and then just scrolling text that whips by? Another example of the effect I'm going for was the news ticker on AOL instant messenger. A bunch of hyperlinks whip by with news headlines; you click on the news headlines to go to the article. This type of thing is possible with the CBannerStatic class. Of course, it would be no good if all strings had to have the same style and color, would it? Of course not; each string should be able to have its own individual style and color. So what are we going to need to have this control?First off, we're going to need a collection of strings; each string has its own color and style [ie: underlined, italicized, etc...] -- enter the CColorString class. It derives from CString. It uses a DWORD to hold both the color and value parameters. Since a COLORREF uses only the low 3 bytes to keep track of colors, I use the high byte to store style information ... like whether the string is italicized, underlined, or bold. CColorString also can store a background color; I waste another DWORD for this. In the future, I may move the style values to BOOL types so that the code is more understandable; we're supposed to get away from bit-masking operations in C++!Now that we have a class to encapsulate strings that know their own style, we need a control that knows how to display them. Enter CMultiColorStatic. It's quite similar to CColorStatic-type controls ... but it is one static object that will allow multiple strings to be entered; each string has its own style. This is done by having a CPtrArray keep track of all of the CColorStrings that have been added to the control. Granted, there isn't a whole lot of gain by using one CMultiColorStatic instead of a bunch of CColorStatic's; I just wanted one control to be the base for CBannerStatic.Speaking of CBannerStatic, that's the last piece of the puzzle. CBannerStatic combines scrolling with having multiple strings. For scrolling, it uses multimedia timers so that similar precision can be achieved on any windows platform [with normal timers, WinNT has 10ms precision, while Win9x has only 55ms precision]. I use the multimedia timers only for precision; when I receive the timer message, I post a WM_TIMER message to the control and the drawing is done in the WM_TIMER handler. When drawing becomes complicated, the app containing the banner could become unresponsive because the drawing takes longer than the scrolling ... and by the time the drawing is done it's time to scroll again, etc.... By retaining a message structure, the app will never become unresponsive.The entire thing is fairly simple to use, but it'll take some time getting used to, I think. CBannerStatic provides a neat way to allow the user to click on an item and get results. The client can set an item cursor as well as an ItemClick callback function. It'd be too long to put everything here, but the sample app BannerTester is pretty comprehensive in going through the feature-set of CBannerStatic [as well as CMultiColorStatic].Some caveats: The thing can be slow if it is made to be large and/or has a lot of message strings. It will bog down the entire system so beware! One last note: I don't like to use Precompiled Headers and you'll find that if you just use the classes as provided, the compiler will complain about not having "StdAfx.h" included. If you get this problem, you can just add #include "StdAfx.h" to each cpp file for each of the three classes. Downloads
    http://www.codeguru.com/staticctrl/BannerStatic.html
      

  4.   

    http://www.codeguru.com/staticctrl/BannerTester.zip
      

  5.   

    我以前找到一个继承自cstatic得类叫CMatrixStatic可以实现
    而且听好玩得,你可以到codeguru搜索看
    要么留下e_mail发给你