我有个简单的功能想实现,各位帮我看看 |
答題得分者是:pceyes
|
zhouying82
高階會員 ![]() ![]() ![]() ![]() 發表:150 回覆:272 積分:189 註冊:2004-03-16 發送簡訊給我 |
|
pceyes
尊榮會員 ![]() ![]() ![]() ![]() ![]() ![]() 發表:70 回覆:657 積分:1140 註冊:2003-03-13 發送簡訊給我 |
寫8分鐘完成
它顯示的已是檔名,顯示圖示的部份自己做吧! pas file : [code delphi] unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls; type TForm1 = class(TForm) ListBox1: TListBox; Button1: TButton; Lb_show: TLabel; Timer1: TTimer; Timer2: TTimer; lb_clock: TLabel; procedure Timer1Timer(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Timer2Timer(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; iclock : integer; // 讀秒 iposition : integer; // listbox1 指針 implementation {$R *.dfm} // 依listbox顯示檔名 procedure TForm1.Timer1Timer(Sender: TObject); begin if (iposition > listbox1.Count -1) then begin iposition := 0; end else begin Inc(iposition); lb_show.Caption := listbox1.Items[iPosition]; end; end; // 按下開始鍵 procedure TForm1.Button1Click(Sender: TObject); begin // 剛按下就顯示第一筆 iposition :=0; lb_show.Caption := listbox1.Items[iposition]; timer1.Enabled := true; Timer2.Enabled := true; end; // 顯示目前秒數 procedure TForm1.Timer2Timer(Sender: TObject); begin inc(iclock); lb_clock.Caption := inttostr(iclock); if iclock = 8 then begin iclock := 0; end; end; end. [/code] dfm file : [code delphi] object Form1: TForm1 Left = 192 Top = 107 Width = 544 Height = 375 Caption = 'Form1' Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = False PixelsPerInch = 96 TextHeight = 13 object Lb_show: TLabel Left = 240 Top = 152 Width = 225 Height = 65 Caption = 'Lb_show' Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -19 Font.Name = 'MS Sans Serif' Font.Style = [fsBold] ParentFont = False end object lb_clock: TLabel Left = 240 Top = 88 Width = 66 Height = 20 Caption = 'lb_clock' Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -16 Font.Name = 'MS Sans Serif' Font.Style = [fsBold] ParentFont = False end object ListBox1: TListBox Left = 40 Top = 32 Width = 169 Height = 273 ImeName = '中文 (繁體) - 倉頡' ItemHeight = 13 Items.Strings = ( 'First_1.bmp' 'Second_2.bmp' 'Third_3.bmp' 'Ford_4.bmp' 'Five_5.bmp' 'Six_6.bmp' 'Seven_7.bmp' 'Eight_8.bmp' 'Nitht_9.bmp' 'Ten_10.bmp' '' '' '' '' '' '' '' '') TabOrder = 0 end object Button1: TButton Left = 240 Top = 248 Width = 201 Height = 49 Caption = 'start' TabOrder = 1 OnClick = Button1Click end object Timer1: TTimer Enabled = False Interval = 8000 // 先設為8秒 OnTimer = Timer1Timer Left = 264 Top = 48 end object Timer2: TTimer Enabled = False OnTimer = Timer2Timer Left = 264 Top = 16 end end [/code]
------
努力會更接近成功
編輯記錄
pceyes 重新編輯於 2008-09-27 07:41:21, 註解 補註解‧
|
mayingjie313
一般會員 ![]() ![]() 發表:7 回覆:11 積分:3 註冊:2008-09-23 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |