Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Form1
- Private IsFullScreen As Boolean = False
- Private ImageIndex As Integer = -1
- Private ImageDir As IO.FileInfo()
- Private frm As Form
- Private FullSizePic As PictureBox
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- Dim dlg As New FolderBrowserDialog
- If dlg.ShowDialog = DialogResult.OK Then
- AuthorCodeImageGalleryVB1.Directorypath = dlg.SelectedPath
- TextBox1.Text = dlg.SelectedPath
- End If
- End Sub
- Private Sub AuthorCodeImageGalleryVB1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AuthorCodeImageGalleryVB1.Load
- End Sub
- Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
- If TextBox1.Text <> "" Then
- Dim di As New IO.DirectoryInfo(TextBox1.Text)
- ImageDir = di.GetFiles("*.jpg").Concat(di.GetFiles("*.bmp")).Concat(di.GetFiles("*.png")).Concat(di.GetFiles("*.gif")).ToArray
- Dim dra As IO.FileInfo
- frm = New Form
- frm.Name = "frm"
- FullSizePic = New PictureBox
- FullSizePic.Dock = DockStyle.Fill
- FullSizePic.BackColor = Color.Black
- FullSizePic.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom
- frm.Controls.Add(FullSizePic)
- AddHandler frm.KeyDown, AddressOf frm_keydown
- frm.Show()
- Timer1.Enabled = True
- EnterFullScreen(frm)
- GetnextImage()
- End If
- End Sub
- Private Sub GetnextImage()
- If Not ImageDir Is Nothing Then
- If ImageIndex < ImageDir.Length - 1 Then
- ImageIndex += 1
- FullSizePic.ImageLocation = ImageDir(ImageIndex).FullName
- ElseIf ImageIndex = ImageDir.Length - 1 Then
- ImageIndex = 0
- FullSizePic.ImageLocation = ImageDir(ImageIndex).FullName
- End If
- End If
- End Sub
- Public Sub LeaveFullScreen(ByVal targetForm As Form)
- If IsFullScreen Then
- ' Restore the original Window state.
- targetForm.WindowState = FormWindowState.Normal
- targetForm.FormBorderStyle = FormBorderStyle.None
- targetForm.TopMost = topMost
- targetForm.Bounds = bounds
- IsFullScreen = False
- Timer1.Enabled = False
- targetForm.Close()
- End If
- End Sub
- Public Sub EnterFullScreen(ByVal targetForm As Form)
- If Not IsFullScreen Then
- targetForm.WindowState = FormWindowState.Maximized
- targetForm.FormBorderStyle = FormBorderStyle.None
- targetForm.TopMost = True
- targetForm.Bounds = Screen.GetBounds(targetForm)
- IsFullScreen = True
- End If
- End Sub
- Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
- GetnextImage()
- End Sub
- Private Sub frm_keydown()
- LeaveFullScreen(frm)
- End Sub
- Private Sub ExitToolStripMenuItem_Click()
- LeaveFullScreen(frm)
- End Sub
- Private Sub Pic1_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs)
- End Sub
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- SplashScreen1.BarLong(100)
- Dim i As Integer = 0
- While i <= 100
- SplashScreen1.ShowBar(i)
- i += 1
- Threading.Thread.Sleep(100)
- End While
- End Sub
- End Class
Add Comment
Please, Sign In to add comment