【发布时间】:2015-01-06 04:54:37
【问题描述】:
我有一个包含 4 个图片框的面板的表单:
我有一个带有以下代码的加载图像按钮,用于将图像加载到图片框中:
'Procedure to upload images through the button click
'open Dialog box to load image
ofd.FileName = Nothing
'Show dialog box above all froms
ofd.Multiselect = False
ofd.Title = "Select Image to Upload"
ofd.Filter = "Image Files |*.jpg*"
ofd.ShowDialog()
'Select file and place on picture box
If Not ofd.FileName = Nothing Then
picBox.ImageLocation = ofd.FileName
End If
'Show the button to delete image
btn.Visible = True
当我只有一个框要填充时,该过程运行良好,但现在我有 4 个,我不想为每个框创建一个按钮。我的问题是,我如何使用相同的程序(或类似的程序)将图片加载到第一个以外的框中。
它们需要按顺序加载。例如,单击按钮,加载左上框,再次单击并加载右上框。因此,如果所有 4 个框都没有图像,则左上角优先,如果左上角有图像,则右上角其次,依此类推。
【问题讨论】: