係vb入面點樣用一個picture box 分別show 8張圖出黎?

2007-05-04 8:05 am
係唔係要用for...next果d? 同埋要整個timer?

唔該show 1 show 大約條code係點!!

假設d圖ge名係 :
picture1,picture2,picture3,picture4,picture5,picture6,picture7,picture8

=======================================================
順便問埋...如果我想有2個選擇,整埋個radio button 出黎,
當選擇radio button1 d圖就半秒一張
當選擇radio button2 d圖就一秒一張
咁洗唔洗整2個timer嫁?

回答 (2)

2007-05-04 1:03 pm
✔ 最佳答案
Create a Timer control, A PictureBox control and two Radio Buttons
1 個 timer, 不需要 For Loop

' declare variables at module level
Private Picture_Array
Private counter As Integer

Private Sub Form_Load()
' 8 張圖要 8 個 file name, full path
Picture_Array = Array("c:\picture1.jpg", "c:\picture2.jpg", "c:\picture3.jpg")
End Sub

Private Sub Option1_Click()
' 一秒換一張
Timer1.Interval = 1000
End Sub

Private Sub Option2_Click()
' 半秒換一張
Timer1.Interval = 500
End Sub

Private Sub Timer1_Timer()
Picture1.Picture = LoadPicture(Picture_Array(counter))
counter = counter + 1
If counter = 3 Then ' 8 張圖 counter 就改為 8
counter = 0
End If
End Sub
2007-05-04 9:22 am
不如你將d圖 顯示個度set false 然後用timer 計時 將佢地變返 true / false
好耐冇用 唔太記得 求奇比個辦法你=_=


收錄日期: 2021-04-12 21:38:44
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20070504000051KK00029

檢視 Wayback Machine 備份