Public Class Form1
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Dim img As Image
Dim imgStream As New IO.MemoryStream
Dim fileName As String = "C:\Users\User\Documents\Visual Studio 2010\Projects\WindowsApplication3\WindowsApplication3\jpg\"
Dim result As String
Select Case ListBox1.TabIndex
Case 0
img = Image.FromFile(fileName & "i1.png")
img.Save(imgStream, Drawing.Imaging.ImageFormat.Png)
img.Dispose()
PictureBox1.Image = Image.FromStream(imgStream)
result = (fileName & "i1.txt")
RichTextBox1.LoadFile(result, RichTextBoxStreamType.PlainText)
Case 1
img = Image.FromFile(fileName & "i3g.png")
img.Save(imgStream, Drawing.Imaging.ImageFormat.Png)
img.Dispose()
PictureBox1.Image = Image.FromStream(imgStream)
result = (fileName & "i3g.txt")
RichTextBox1.LoadFile(result, RichTextBoxStreamType.PlainText)
End Select
End Sub
End Class
沒有留言:
張貼留言