显示相机图像在VS PictureBox W/0保存到PC驱动器



如果我将从相机传输的图像保存(到磁盘),我可以在PictureBox中显示它,如下所示:

Dim picNum As Integer = 1
Dim imgName As String
Dim imgExt As String
Dim WiaDialog1 As New WIA.CommonDialog
Dim WiaDevice1 As WIA.Device = WiaDialog1.ShowSelectDevice(WIA.WiaDeviceType.CameraDeviceType, False, False)
imgName = WiaDevice1.Items(picNum).Properties("Item Name").Value
imgExt = "." & WiaDevice1.Items(picNum).Properties("Filename extension").Value
Dim image1 As WIA.ImageFile = WiaDevice1.Items(picNum).Transfer(WIA.FormatID.wiaFormatPNG)
image1.SaveFile("C:PhotoSortCameraNew2" & imgName & imgExt)
image1 = "C:PhotoSortCameraNew2" & imgName & imgExt"  
PictureBox1.Image = image1

我要显示传输的图像,在类似的VB代码方式,。不保存到磁盘

您可以从物理位置显示图像,如

Picturebox1.Image=Image.FromFile("Path");

最新更新