请各位高手指导!这是我用.net编写的一个小程序我检查了几遍没有发现什么错误,可以运行但是无法查看图片
请各位高手帮忙看看那里出现了问题.谢谢这个是代码:PrivateSubbutton_Click(ByValsenderAsSystem.Object,ByValeAsSy...
请各位高手帮忙看看那里出现了问题.谢谢 这个是代码: Private Sub button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button.Click
'浏览文件夹
private sud Button1_click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles button1.click
Me.ListBox1.Items.Clear()
Dim mydlg As New FolderBrowserDialog()
If (mydlg.ShowDialog() = System.Windows.Forms.DialogResult.OK) Then
Me.TextBox1.Text = mydlg.SelectedPath
Dim i As Integer = 0
Dim myfilter As String = ""
myfilter = "*.jgp"
For i = 0 To System.IO.Directory.GetFiles(mydlg.SelectedPath, myfilter).Length - 1 Step 1
Me.ListBox1.Items.Add(System.IO.Directory.GetFiles(mydlg.SelectedPath, myfilter)(i))
Next
myfilter = "*.bmp"
For i = 0 To System.IO.Directory.GetFiles(mydlg.SelectedPath, myfilter).Length - 1 Step 1
Me.ListBox1.Items.Add(System.IO.Directory.GetFiles(mydlg.SelectedPath, myfilter)(i))
Next
myfilter = "*.tif"
For i = 0 To System.IO.Directory.GetFiles(mydlg.SelectedPath, myfilter).Length - 1 Step 1
Me.ListBox1.Items.Add(System.IO.Directory.GetFiles(mydlg.SelectedPath, myfilter)(i))
Next
myfilter = "*.png"
For i = 0 To System.IO.Directory.GetFiles(mydlg.SelectedPath, myfilter).Length - 1 Step 1
Me.ListBox1.Items.Add(System.IO.Directory.GetFiles(mydlg.SelectedPath, myfilter)(i))
Next
End If
End Sub
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
'显示图像
End Sub
Private Sub listbox1_selectedindexchanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Dim myfilename As String = Me.listbox1.selecteditem.tostring()
Me.picturebox1.image = System.drawing.bitmap.fromfile(myfilename)
End Sub
Private Function picturebox1() As Object
Throw New NotImplementedException
End Function
End Class 展开
'浏览文件夹
private sud Button1_click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles button1.click
Me.ListBox1.Items.Clear()
Dim mydlg As New FolderBrowserDialog()
If (mydlg.ShowDialog() = System.Windows.Forms.DialogResult.OK) Then
Me.TextBox1.Text = mydlg.SelectedPath
Dim i As Integer = 0
Dim myfilter As String = ""
myfilter = "*.jgp"
For i = 0 To System.IO.Directory.GetFiles(mydlg.SelectedPath, myfilter).Length - 1 Step 1
Me.ListBox1.Items.Add(System.IO.Directory.GetFiles(mydlg.SelectedPath, myfilter)(i))
Next
myfilter = "*.bmp"
For i = 0 To System.IO.Directory.GetFiles(mydlg.SelectedPath, myfilter).Length - 1 Step 1
Me.ListBox1.Items.Add(System.IO.Directory.GetFiles(mydlg.SelectedPath, myfilter)(i))
Next
myfilter = "*.tif"
For i = 0 To System.IO.Directory.GetFiles(mydlg.SelectedPath, myfilter).Length - 1 Step 1
Me.ListBox1.Items.Add(System.IO.Directory.GetFiles(mydlg.SelectedPath, myfilter)(i))
Next
myfilter = "*.png"
For i = 0 To System.IO.Directory.GetFiles(mydlg.SelectedPath, myfilter).Length - 1 Step 1
Me.ListBox1.Items.Add(System.IO.Directory.GetFiles(mydlg.SelectedPath, myfilter)(i))
Next
End If
End Sub
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
'显示图像
End Sub
Private Sub listbox1_selectedindexchanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Dim myfilename As String = Me.listbox1.selecteditem.tostring()
Me.picturebox1.image = System.drawing.bitmap.fromfile(myfilename)
End Sub
Private Function picturebox1() As Object
Throw New NotImplementedException
End Function
End Class 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询