Dim ImagePath As String = "images/spaceship2.png"
Dim img1 As Bitmap
Dim newImage As Image = Image.FromFile("images/spaceship2.png")
img1 = New Bitmap(ImagePath)
pb2.ImageLocation = ImagePath
pb1.Image = newImage
我想显示文件夹中的图像,例如,ID号为22137471的学生,名称为22137471的图片将显示在我的图片框之间,我在谷歌的某个地方看到了这段代码。
答案 0 :(得分:8)
我想显示文件夹中的图片,例如,有id的学生 数量为22137471,图片名称为22137471 显示在我的照片框上
尝试类似......
Dim id As String = "22137471"
Dim folder As String = "c:\some path\folder"
Dim filename As String = System.IO.Path.Combine(folder, id & ".png")
PictureBox1.Image = Image.FromFile(filename)
答案 1 :(得分:0)
你可以试试这个:
PictureBox1.Image = Image.FromFile("c:\some path\folder\myImage.jpg")