1。如何实现静态方法,即不用生成类的实例而调用类的方法。
2。如何改变ProgressBar中进度条的颜色。

解决方案 »

  1.   

    usesCommCtrl;procedure TForm1.Button1Click(Sender: TObject);begin// Set the Background color to tealProgressbar1.Brush.Color := clTeal;// Set bar color to yellowSendMessage(ProgressBar1.Handle, PBM_SETBARCOLOR, 0, clYellow);end;WinXP风格进度条const{$EXTERNALSYM PBS_MARQUEE}PBS_MARQUEE = 08; procedure TForm1.FormCreate(Sender: TObject);beginSetWindowLong(ProgressBar1.Handle, GWL_STYLE,GetWindowLong(ProgressBar1.Handle, GWL_STYLE) or PBS_MARQUEE);end;//------------------------------------------------------------------------------procedure TForm1.Button1Click(Sender: TObject);vari: Integer;beginfor i := 0 to 30 dobeginSleep(100);ProgressBar1.StepIt;Application.ProcessMessages;end;end; 
      

  2.   

    class function fname(params)
      

  3.   

    你声明一个类方法的时候,默认都是STATIC的;
    Methods are by default static. When a static method is called, the declared (compile-time) type of the class or object variable used in the method call determines which implementation to activate. In the following example, the Draw methods are static.type
      TFigure = class
        procedure Draw;
      end;
      TRectangle = class(TFigure)
        procedure Draw;
      end;
      

  4.   

    我知道C++可以声明静态方法,不需要生成实例就可以直接调用。Delphi我不是很清楚。
    如果一定需要,可以声明全局函数啊。
      

  5.   

    WinXP风格进度条,好像没有什么效果???
    关于静态方法,我只是想探讨一下,怎样实现我知道,只是觉得既然支持oop那么就应该有静态方法。
    天外流星的话我不动,既然是静态的为什么不可以不需要生成实例就直接调用???