有關visual basic o既問題

2008-11-24 2:03 am
我想請問,係vb 入面,我有8 幅圖,我想呢8幅圖順次序咁顯示出o黎,而每幅圖所相隔的時間則由 RadioButton 控制,即係可能我有3 個RadioButton 分別為 1 秒,2 秒及3 秒 而該8幅圖則會因應我選擇的RadioButton 不同而圖與圖所顯示的時間不同,因我係新手,很多地方也不太明白,如可以請詳細小小解答

thx a lot

回答 (1)

2008-11-24 5:14 am
✔ 最佳答案
寫D pseudo-code比你參考下啦
無寫VB幾十世,希望D syntax唔會錯得太離譜啦~~
----------------------------------------------------

Components needed:

Timer 'Change the image in ImgPic in the required interval
- Name: tmrChangePic
- Interval: 1000 'Default 1 sec per tick
- Enabled = true

RadioButton(3) 'Control the interval of tmrChangePic
- Name: radTime(3)
- radTime(0) represents 1 sec, radTime(1) represents 2 sec, radTime(2) represents 3 sec

ImageList 'Contains those 8 images
- Name: ImgLst

Image 'Image box that shows the image
- Name: ImgPic

----------------------------------------------------

Pseudo-Code:

Option Explicit

Dim i As Integer

Private Sub Form_Load()
i = 0
End Sub

Private Sub tmrChangePic()
If i < 7 Then
i = i + 1
Else
i = 0
End if
ImgPic.Picture = ImgLst.Images(i)
End Sub

Private Sub radTime_Change(Index As Integer)
tmrChangePic.inteval = (Index+1)*1000
End Sub

----------------------------------------------------
參考: 僅餘的,封了塵的記憶


收錄日期: 2021-04-13 16:17:36
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20081123000051KK01669

檢視 Wayback Machine 備份