VBa:多个图片框上的多张图片

时间:2021-01-16 00:24:28

hi its a catalogue application I have 50 pictures on my folder but i want in the app load show 12 pictures in 12 picturebox i use this code but it gives me nothing

在它的目录应用程序我有50张图片在我的文件夹但我想在应用程序加载显示12图片在12 picturebox我使用此代码,但它没有给我任何帮助

 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

       Dim pic As PictureBox

    For i = 0 To 12
        pic = Me.Controls("picturebox" & i)
        pic.Image = Image.FromFile("C:\Dev\Images\TEST400.jpg")
    Next i



End Sub

Help plz

帮助PLZ

1 个解决方案

#1


1  

Your image files should be saved as TEST1.jpg,TEST2.jpg, ......TEST12.jpg etc.

您的图像文件应保存为TEST1.jpg,TEST2.jpg,...... TEST12.jpg等。

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

       Dim pic As PictureBox

    For i = 1 To 12
        pic = Me.Controls("picturebox" & i)
        pic.Image = Image.FromFile(@"C:\Dev\Images\TEST" + i.ToString +".jpg")
    Next i



End Sub

Note: I just wrote this code here only. Its not tested.

注意:我刚刚在这里编写了这段代码。它没有经过测试。

#1


1  

Your image files should be saved as TEST1.jpg,TEST2.jpg, ......TEST12.jpg etc.

您的图像文件应保存为TEST1.jpg,TEST2.jpg,...... TEST12.jpg等。

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

       Dim pic As PictureBox

    For i = 1 To 12
        pic = Me.Controls("picturebox" & i)
        pic.Image = Image.FromFile(@"C:\Dev\Images\TEST" + i.ToString +".jpg")
    Next i



End Sub

Note: I just wrote this code here only. Its not tested.

注意:我刚刚在这里编写了这段代码。它没有经过测试。