簡體   English   中英

在VB中設置圖片

[英]Set Image in VB

好的,所以我試圖制作一個加載屏幕,該屏幕上有六個點點亮,然后重置直到完成加載。 前兩個點會更改圖片,但第三個點不會更改! 我該如何解決! 我的代碼:

If picbox1.image is image1 then
  picbox1.image = image 2
ElseIf picbox1.image is image 2
  picbox2.image = image 2
ElseIf picbox2.image is image 2
  picbox3.image = image 2

全部都在計時器內部,間隔為1000(1秒)

這是我的項目文件: https : //www.dropbox.com/s/v4qf8zlyrz1616s/The%20Eye%20OS.zip

只需在Elseifs之后添加“ Not”

If picbox1.image is image1 then
 picbox1.image = image 2
ElseIf Not picbox2.image is image 2
 picbox2.image = image 2
ElseIf Not picbox3.image is image 2
 picbox3.image = image 2
'So on
End If

我檢查了您的項目,這是下面為您提供的完整解決方案:

Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
    If Dot1.Image Is UnDot Then
        Dot1.Image = LoDot
    ElseIf Not Dot2.Image Is LoDot Then
        Dot2.Image = LoDot
    ElseIf Not Dot3.Image Is LoDot Then
        Dot3.Image = LoDot
    ElseIf Not Dot4.Image Is LoDot Then
        Dot4.Image = LoDot
    ElseIf Not Dot5.Image Is LoDot Then
        Dot5.Image = LoDot
    ElseIf Not Dot6.Image Is LoDot Then
        Dot6.Image = LoDot
    Else
        Dot1.Image = UnDot
        Dot2.Image = UnDot
        Dot3.Image = UnDot
        Dot4.Image = UnDot
        Dot5.Image = UnDot
        Dot6.Image = UnDot
    End If
End Sub

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM