|
-
Jun 30th, 2005, 02:47 AM
#1
Thread Starter
Member
Can Anyone help in this set of codes?
Hi there.
I have done up a set of codes to view photos/ pictures. The program is working well but, there are some errors. I suspect that it is the logic problem.
Can anyone help to solve it?
Here's some parts of the codes:
Public FileIndex As Integer
'Public FileIndexx As Integer
Public ImageFiles() As FileInfo
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim DirObj As New DirectoryInfo("C:\Documents and Settings\project\My Documents\My Pictures")
ImageFiles = DirObj.GetFiles("*.jpg")
'If ImageFiles.Length = 0 Then
'Me.Close()
'Else
If ImageFiles.Length = 1 Then
'Button1.Text = "Done"
'Else
btnNext.Text = "Next"
End If
FileIndex = 0
Dim MyImage As Image
Try
MyImage = Image.FromFile(ImageFiles(FileIndex).FullName, RichTextBoxStreamType.PlainText)
PicBox().Image = Image.FromFile(ImageFiles(FileIndex).FullName, RichTextBoxStreamType.PlainText)
Catch Ex As Exception
End Try
Me.Text = ImageFiles(FileIndex).FullName
'End If
End Sub
Private Sub open_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles open.Click
Dim open As OpenFileDialog = New OpenFileDialog
open.Title = "Select the image to open."
open.Filter = ("Supported Files|*.gif;*.jpg;*.bmp")
open.ShowDialog()
Dim theImage As New Bitmap(open.FileName)
PicBox.Image = theImage
End Sub
Private Sub rotate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rotate.Click
PicBox.Image.RotateFlip(RotateFlipType.Rotate90FlipNone)
PicBox.Refresh()
End Sub
Private Sub exitleft_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles exitleft.Click
Close()
End Sub
Private Sub btnPre_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPre.Click
FileIndex = FileIndex - 1
If FileIndex = ImageFiles.Length Then
Me.Close()
Else
If FileIndex = (ImageFiles.Length + 1) Then
btnPre.Text = "Done"
End If
Dim MyImage As Image
Try
MyImage = Image.FromFile(ImageFiles(FileIndex).FullName, RichTextBoxStreamType.PlainText)
PicBox().Image = Image.FromFile(ImageFiles(FileIndex).FullName, RichTextBoxStreamType.PlainText)
Catch Ex As Exception
End Try
'Me.Text = ImageFiles(FileIndex).FullName
End If
End Sub
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
FileIndex = FileIndex + 1
If FileIndex = ImageFiles.Length Then
Me.Close()
Else
If FileIndex = (ImageFiles.Length - 1) Then
'btnNext.Text = "Done"
btnNext.Text = "Next"
End If
Dim MyImage As Image
Try
MyImage = Image.FromFile(ImageFiles(FileIndex).FullName, RichTextBoxStreamType.PlainText)
PicBox().Image = Image.FromFile(ImageFiles(FileIndex).FullName, RichTextBoxStreamType.PlainText)
Catch Ex As Exception
End Try
'Me.Text = ImageFiles(FileIndex).FullName
End If
End Sub
Thanks so much!
Last edited by longdexin; Jul 12th, 2005 at 01:07 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|