一个方法是用图片,一个方法是改变颜色!
用图片的方法我刚才测试了一下,但是突然Down机了,没有存盘!//faint。
思路是这样的:
自己继承一个TProgressBar,拦截PBM_STEPIT消息,把图片的位置改变即可!
用GetDC(handle),然后用bitblt把那个图片画到bar上面。需要具体的代码,等我吃了饭再说!

解决方案 »

  1.   

    哎,懒的详细调试了,这个思路(图片)我就写到这个地方,那个高手再出招吧。
    随便写写,还有很多要考虑的地方,用另外一个方法也行!(改变颜色)
    type
     tmyprogressbar=class(tprogressbar)
       constructor create(p:TComponent);override;
       destructor Destroy;override;
       procedure mystepit(var msg:tmessage);message PBM_STEPIT;
       private
         bmp:tbitmap;
     end;destructor tmyprogressbar.Destroy;
    begin
      bmp.free;
      inherited;
    end;constructor Tmyprogressbar.create(p:TComponent);
    begin
      inherited;
      bmp:=tbitmap.Create;
      bmp.LoadFromFile('c:\temp.bmp');
    end;procedure TMyprogressbar.mystepit(var msg:tmessage);
    var
     dc:hdc;
    begin
    //  position:=position+1;
      dc:=getdc(handle);
      bitblt(dc,1,0,100,20,bmp.canvas.Handle,0,0,srccopy);
    end;