Delphi是一種具有強大功能的編程語言,用它可以輕松創(chuàng)建任何一種數(shù)據(jù)庫應用程序。將3DS動畫文件。FLC分解后,按先后順序存于Delphi提供的Graphics數(shù)據(jù)類型中,通過讀取Graphics類型的圖形數(shù)據(jù),在窗口中實現(xiàn)動畫效果。
1.將DOS分解的圖片存于數(shù)據(jù)庫中
(1)進入3DS的KeyFrame模塊,在Output選項中選擇.BMP類型的文件。將圖形文件全部存于同一目錄中(例如目錄c:pic,文件可為f0001.bmp,...,f0045.bmp)。
(2)利用Delphi的數(shù)據(jù)工具DeskTop建立一個圖形數(shù)據(jù)庫Pic.db,其中包括圖形文件名filename和圖片picture兩個字段。
(3)創(chuàng)建Name為FrmPic的窗體Form1,從DataAccess頁中選擇Table組件,并將其放入窗體Form1中,其屬性為:
Nametable1
DataBaseMYWORK
TableNamePic.db
從DataAccess頁中選擇DataSource組件,放入Form1窗體中,設置屬性為:
NameDataSource1
DataSettable1
從DataControl頁中選擇DBImage選件,放入Form1窗體中,設置屬性為:
Nameimage1
DataSourceDataSource1
DataFieldPicture
StretchTrue
(4)為FrmPic窗體的FormCreate事件填寫如下代碼:
procedureTform1.FormCreate(Sender:Tobject);
begin
table1.open;
withtable1do
begin
whilenoteofdo
begin
image1.picture.loadfromfile(fieldbyname(′filename′).a(chǎn)sstring);
edit;
fieldbynmae(′picture′).a(chǎn)ssign(image1.picture.graphics);
next;
end;
end;
end;
2.使用Timer組件實現(xiàn)動畫演播
從System頁中選擇Timer組件放置到窗體Frmpic中,設置屬性如下:
NametrmSpeed
EnabledFalse
Interval250
Timer組件的OnTimer事件定期自動發(fā)生。例如設置tmrSpeed組件的Interval屬性為250,那么,tmrSpeedTimer過程,每隔250毫秒都將會自動執(zhí)行。為tmrSpeedTimer過程的OnTimer事件填加的代碼為:
procedureTform1.Timer1Timer(Sender:Tobject);
begin
table1.next;
iftable1eofthentable1.first;
end;
1.將DOS分解的圖片存于數(shù)據(jù)庫中
(1)進入3DS的KeyFrame模塊,在Output選項中選擇.BMP類型的文件。將圖形文件全部存于同一目錄中(例如目錄c:pic,文件可為f0001.bmp,...,f0045.bmp)。
(2)利用Delphi的數(shù)據(jù)工具DeskTop建立一個圖形數(shù)據(jù)庫Pic.db,其中包括圖形文件名filename和圖片picture兩個字段。
(3)創(chuàng)建Name為FrmPic的窗體Form1,從DataAccess頁中選擇Table組件,并將其放入窗體Form1中,其屬性為:
Nametable1
DataBaseMYWORK
TableNamePic.db
從DataAccess頁中選擇DataSource組件,放入Form1窗體中,設置屬性為:
NameDataSource1
DataSettable1
從DataControl頁中選擇DBImage選件,放入Form1窗體中,設置屬性為:
Nameimage1
DataSourceDataSource1
DataFieldPicture
StretchTrue
(4)為FrmPic窗體的FormCreate事件填寫如下代碼:
procedureTform1.FormCreate(Sender:Tobject);
begin
table1.open;
withtable1do
begin
whilenoteofdo
begin
image1.picture.loadfromfile(fieldbyname(′filename′).a(chǎn)sstring);
edit;
fieldbynmae(′picture′).a(chǎn)ssign(image1.picture.graphics);
next;
end;
end;
end;
2.使用Timer組件實現(xiàn)動畫演播
從System頁中選擇Timer組件放置到窗體Frmpic中,設置屬性如下:
NametrmSpeed
EnabledFalse
Interval250
Timer組件的OnTimer事件定期自動發(fā)生。例如設置tmrSpeed組件的Interval屬性為250,那么,tmrSpeedTimer過程,每隔250毫秒都將會自動執(zhí)行。為tmrSpeedTimer過程的OnTimer事件填加的代碼為:
procedureTform1.Timer1Timer(Sender:Tobject);
begin
table1.next;
iftable1eofthentable1.first;
end;