(3)创建Name为FrmPic的窗体Form1,从DataAccess页中选择Table组件,并将其放入窗体Form1中,其属性为: Name
table1 DataBase MYWORK TableName
Pic.db
从DataAccess页中选择DataSource组件,放入Form1窗体中,设置属性为: Name
DataSource1 DataSet
table1
从DataControl页中选择DBImage选件,放入Form1窗体中,设置属性为: Name
image1 DataSource DataSource1 DataField Picture Stretch
True
(4)为FrmPic窗体的FormCreate事件填写如下代码: procedureTform1.FormCreate(Sender:Tobject); begin table1.open; with
table1 do begin while not eof do
begin image1.picture.loadfromfile(fieldbyname(filename).asstring); edit; fieldbynmae(picture).assign(image1.picture.graphics); next; end; end; end;
2.使用Timer组件实现动画演播 从System页中选择Timer组件放置到窗体Frmpic中,设置属性如下: Name
trmSpeed Enabled False Interval
250 Timer组件的OnTimer事件定期自动发生。例如设置tmrSpeed组件的Interval属性为250,那么,tmrSpeedTimer过程,每隔250毫秒都将会自动执行。为tmrSpeedTimer过程的OnTimer事件填加的代码为: procedureTform1.Timer1Timer(Sender:Tobject); begin table1.next; if
table1.eof then table1.first; end;