Dobrý den, zde je kod na změnu obrázku plochy jenže když zmáčknu tlačítko preview to má odeslat obrázek do pictureboxu jenže pi zmáčkutí nastane chyba v řádku
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
PIC_Preview.Load(FileDIR.Text & FileNUM.Text & FileTYPE.Text)
End Sub
Zde pro jistotu celý kod:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = True
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Enabled = False
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
PIC_Preview.Load(FileDIR.Text & FileNUM.Text & FileTYPE.Text)
End Sub
Private Declare Auto Function SystemParametersInfo Lib "user32.dll" (ByVal uAction As Integer, ByVal uParam As Integer, ByVal lpvParam As String, ByVal fuWinIni As Integer) As Integer
Public Shared Sub SetWallpaper(ByVal Wallpaper As Object)
Dim Background As System.Drawing.Image = Nothing
If TypeOf Wallpaper Is String Then
Background = System.Drawing.Image.FromFile(Wallpaper)
ElseIf TypeOf Wallpaper Is Image Then
Background = Wallpaper
Else
Exit Sub
End If
Dim Location As String = Environment.SystemDirectory & "\CurrentWallpaper.Bmp"
Background.Save(Location, System.Drawing.Imaging.ImageFormat.Bmp)
SystemParametersInfo(&H14, 0, Location, &H1 Or &H2)
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
RealSEC.Text = DateAndTime.Now.Second
End Sub
Private Sub RealSEC_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RealSEC.TextChanged
SecA.Text = SecA.Text - 1
End Sub
Private Sub SecA_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SecA.TextChanged
If SecA.Text < 0 Then
SecA.Text = 59
MinA.Text = MinA.Text - 1
End If
End Sub
Private Sub MinA_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MinA.TextChanged
If MinA.Text < 0 Then
MinA.Text = 59
HourA.Text = HourA.Text - 1
End If
End Sub
Private Sub HourA_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HourA.TextChanged
If HourA.Text < 0 Then
HourA.Text = 23
DayA.Text = DayA.Text - 1
End If
End Sub
Private Sub DayA_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DayA.TextChanged
If DayA.Text < 0 Then
DayA.Text = DayB.Text
HourA.Text = HourB.Text
MinA.Text = MinB.Text
SecA.Text = SecB.Text
FileNUM.Text = FileNUM.Text + 1
SetWallpaper(FileDIR.Text & FileNUM.Text & FileTYPE.Text)
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
FileNUM.Text = 0
End Sub
Private Sub FileNUM_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FileNUM.TextChanged
If FileNUM.Text = TOT_Images.Text = True Then
FileNUM.Text = 1
End If
End Sub
End Class
Za pomoc děkuji.
|