首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ Builder >

怎么在状态栏中加入动画 80分啦

2012-02-10 
如何在状态栏中加入动画80分啦想做个界面,在状态栏中加入小的动画,例如就像很多软件在状态栏中都有个旋转

如何在状态栏中加入动画 80分啦
想做个界面,在状态栏中加入小的动画,例如就像很多软件在状态栏中都有个旋转的地球一样。怎么样才能做到啊?

[解决办法]
把你想做动画的 StatusPanel-> Style 设成 psOwnerDraw

在StatusBar的OnDrawPanel事件做

下面这个例子是 TProgressBar + TShape,
当然你可以换成你想要的控件,加个动画控件,图片什么的都可以,放avi电影也没问题
例子中加了 4 个StatusPanel,其中index 0,2设成了psOwnerDraw


.h 部份
//---------------------------------------
private:// User declarations
TProgressBar *myProgress;
TShape *myShape;


.cpp部份
//---------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
myProgress = new TProgressBar(this);
myProgress-> Max = 100;
myProgress-> =
myProgress-> BorderWidth = 0;
myProgress-> Position = 50;
myProgress-> Visible = true;

myShape = new TShape(this);
myShape-> Brush-> Color = clRed;
myShape-> Visible = true;
}
//---------------------------------------
void __fastcall TForm1::StatusBar1DrawPanel(TStatusBar *StatusBar,
TStatusPanel *Panel, const TRect &Rect)
{
switch (Panel-> Index) {
case 0 :
myProgress-> Parent = StatusBar;
myProgress-> Top = Rect.Top;
myProgress-> Left = Rect.Left;
myProgress-> Width = Panel-> Width - 3;
myProgress-> Height = StatusBar-> Height - 4;
return;
case 2 :
myShape-> Parent = StatusBar;
myShape-> Top = Rect.Top;
myShape-> Left = Rect.Left;
myShape-> Width = Panel-> Width -3;
myShape-> Height = StatusBar-> Height - 4;
return;
default:
;
}
}
//---------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
myProgress-> Position++;
}
//---------------------------------------

热点排行