Vb.net 从列表框导出下一个图像
我正在尝试为我的堂兄(他的工作需要它)构建一个ImageConverter,以便以以下格式导出图像:1。2500x2500、2.1500x1500和3.800x800 我一次只能以这种格式导出一张图片,但他每天通常有50多张图片需要以这种格式转换,因此我添加了一个列表框,以便他可以在列表框中拖放他的图片。我确实做到了,但我不知道如何导出加载到列表框中的图片,它需要逐个导出。我使用“导出按钮”导出图像的代码如下:Vb.net 从列表框导出下一个图像,vb.net,image,listbox,export,Vb.net,Image,Listbox,Export,我正在尝试为我的堂兄(他的工作需要它)构建一个ImageConverter,以便以以下格式导出图像:1。2500x2500、2.1500x1500和3.800x800 我一次只能以这种格式导出一张图片,但他每天通常有50多张图片需要以这种格式转换,因此我添加了一个列表框,以便他可以在列表框中拖放他的图片。我确实做到了,但我不知道如何导出加载到列表框中的图片,它需要逐个导出。我使用“导出按钮”导出图像的代码如下: If (Not System.IO.Directory.Exists("C:\Use
If (Not System.IO.Directory.Exists("C:\Users\Administrator\Desktop\" + KryptonTextBox1.Text)) Then
System.IO.Directory.CreateDirectory("C:\Users\Administrator\Desktop\" + KryptonTextBox1.Text)
Dim picturepath As String
picturepath = "C:\Users\Administrator\Desktop\" + KryptonTextBox1.Text
pathtxt.Text = picturepath
End If
Dim fileName As String = KryptonListBox1.SelectedItem.ToString()
Dim pathname As String = OpenFileDialog1.FileName
picturename = Path.GetFileNameWithoutExtension(fileName)
BildNametxt.Text = picturename
'converting picture in 2500x2500 format
Try
If (Not System.IO.Directory.Exists(pathtxt.Text + "\Amazon")) Then
System.IO.Directory.CreateDirectory(pathtxt.Text + "\Amazon")
Else
PictureBox2500.BackgroundImage.Save(pathtxt.Text + "\Amazon" + "\" + picturename + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Try
If (Not System.IO.Directory.Exists(pathtxt.Text + "\1500")) Then
System.IO.Directory.CreateDirectory(pathtxt.Text + "\1500")
Else
PictureBox1500.BackgroundImage.Save(pathtxt.Text + "\1500" + "\" + picturename + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Try
If (Not System.IO.Directory.Exists(pathtxt.Text + "\800")) Then
System.IO.Directory.CreateDirectory(pathtxt.Text + "\800")
Else
PictureBox800.BackgroundImage.Save(pathtxt.Text + "\800" + "\" + picturename + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
MessageBox.Show("Images succesfully converted!")
resizedimage2500.Dispose()
resizedimage1500.Dispose()
resizedimage800.Dispose()
那么,如何对加载的列表框执行相同的操作呢?感谢您的帮助!提前感谢您在列表框中到底放了什么?它加载了我需要转换的图片路径。有人能帮我吗?如果您的方法有效,请将其移动到方法(Sub)并在循环中调用它,将每个文件名作为参数传递