【发布时间】:2016-08-02 19:19:57
【问题描述】:
我正在将图片框中的图像添加到流程布局面板。我正在尝试添加一个单击事件,以便在流程布局面板中单击图像时,它将打开原始图像。我的图片是.jpg。这是我到目前为止得到的,但似乎它不起作用。
For Each pic As FileInfo In New DirectoryInfo("picturepath").GetFiles("file.jpg")
Dim picture As New PictureBox
picture .Height = 113
picture .Width = 145
picture .BorderStyle = BorderStyle.Fixed3D
picture .SizeMode = PictureBoxSizeMode.Zoom
picture .Image = Image.FromFile(fi.FullName)
AddHandler picture.MouseClick, AddressOf pictureBox_MouseClick
flowlayoutpanel.Controls.Add(picture)
Next
Public Sub pictureBox_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
====>>> Not sure what goes here to get the correct path of that image since there could be more than one images.
End Sub
【问题讨论】:
-
你能添加你的
picturePreview_MouseClick函数吗 -
@jonju 小文本错误。
-
首先您需要保存源文件的名称/路径 (
fi.FullName) 以便以后访问它。文件路径未编码到图像中
标签: vb.net picturebox flowlayout