我在VB.Net中有一个WinForm ,背景中有一些图像,每 5 秒通过计时器更改一次。问题是它们会立即改变,这看起来不太好。我想添加一些淡入效果,但我得到了 opacity 不是. 我只能淡化表格,但这不是我想要的。tableLayout.backgroundimage
这是我的代码:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If imageNum > 3 Then
imageNum = 1
End If
Select Case imageNum
Case 1
Me.TableLayoutPanel4.BackgroundImage = Global.posta1.My.Resources.Resources.foto1
For FadeIn = 0.0 To 1.1 Step 0.1
Me.Opacity = FadeIn
Threading.Thread.Sleep(100)
Next
rd_btn1.Checked = False
rd_btn2.Checked = True
Case 2
Me.TableLayoutPanel4.BackgroundImage = Global.posta1.My.Resources.Resources.foto3
rd_btn2.Checked = False
rd_btn3.Checked = True
For FadeIn = 0.0 To 1.1 Step 0.1
Me.Opacity = FadeIn
Threading.Thread.Sleep(100)
Next
Case 3
Me.TableLayoutPanel4.BackgroundImage = Global.posta1.My.Resources.Resources.foto2
For FadeIn = 0.0 To 1.1 Step 0.1
Me.Opacity = FadeIn
Threading.Thread.Sleep(100)
Next
rd_btn3.Checked = False
rd_btn1.Checked = True
End Select
imageNum = imageNum + 1
End Sub