Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
BmpAnimate.cpp
Package: c++builder6编程实例.ZIP [view]
Upload User: lulishicai
Upload Date: 2010-03-01
Package Size: 13202k
Code Size: 1k
Category:
Delphi-C++Builder
Development Platform:
C++ Builder
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #pragma hdrstop
- #include "math.h"
- #include "BmpAnimate.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- TForm1 *Form1;
- float a;
- //变量声明
- //---------------------------------------------------------------------------
- __fastcall TForm1::TForm1(TComponent* Owner)
- : TForm(Owner)
- {
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::FormCreate(TObject *Sender)
- {
- Form1->Timer1->Enabled=false;
- //设置Timer1控件处于无效的状态
- a=0;
- //变量初始化
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Timer1Timer(TObject *Sender)
- {
- Image2->Left=Image1->Left+Image1->Width/2+150*cos(a)-Image2->Width/2;
- //计算地球的横坐标
- Image2->Top=Image1->Top+Image1->Height/2+150*sin(a)-Image2->Height/2;
- //计算地球的纵坐标
- Image3->Left=Image2->Left+Image2->Width/2+50*cos(5*a)-Image3->Width/2;
- //计算月亮的横坐标
- Image3->Top=Image2->Top+Image2->Height/2+50*sin(5*a)-Image3->Height/2;
- //计算月亮的纵坐标
- a=a-3.1415926 / 90;
- //角度的变化幅度为20度
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::FormClick(TObject *Sender)
- {
- Form1->Timer1->Enabled=true;
- //开始动画
- }
- //---------------------------------------------------------------------------