dassoubarna

Form1

Feb 29th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 3.64 KB | None | 0 0
  1. Public Class Form1
  2.     Private IsFullScreen As Boolean = False
  3.     Private ImageIndex As Integer = -1
  4.     Private ImageDir As IO.FileInfo()
  5.     Private frm As Form
  6.     Private FullSizePic As PictureBox
  7.  
  8.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  9.         Dim dlg As New FolderBrowserDialog
  10.         If dlg.ShowDialog = DialogResult.OK Then
  11.             AuthorCodeImageGalleryVB1.Directorypath = dlg.SelectedPath
  12.             TextBox1.Text = dlg.SelectedPath
  13.         End If
  14.     End Sub
  15.  
  16.     Private Sub AuthorCodeImageGalleryVB1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AuthorCodeImageGalleryVB1.Load
  17.  
  18.     End Sub
  19.  
  20.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  21.         If TextBox1.Text <> "" Then
  22.  
  23.             Dim di As New IO.DirectoryInfo(TextBox1.Text)
  24.             ImageDir = di.GetFiles("*.jpg").Concat(di.GetFiles("*.bmp")).Concat(di.GetFiles("*.png")).Concat(di.GetFiles("*.gif")).ToArray
  25.             Dim dra As IO.FileInfo
  26.             frm = New Form
  27.             frm.Name = "frm"
  28.             FullSizePic = New PictureBox
  29.             FullSizePic.Dock = DockStyle.Fill
  30.             FullSizePic.BackColor = Color.Black
  31.             FullSizePic.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom
  32.  
  33.             frm.Controls.Add(FullSizePic)
  34.             AddHandler frm.KeyDown, AddressOf frm_keydown
  35.             frm.Show()
  36.             Timer1.Enabled = True
  37.             EnterFullScreen(frm)
  38.             GetnextImage()
  39.         End If
  40.     End Sub
  41.     Private Sub GetnextImage()
  42.  
  43.         If Not ImageDir Is Nothing Then
  44.             If ImageIndex < ImageDir.Length - 1 Then
  45.                 ImageIndex += 1
  46.                 FullSizePic.ImageLocation = ImageDir(ImageIndex).FullName
  47.             ElseIf ImageIndex = ImageDir.Length - 1 Then
  48.                 ImageIndex = 0
  49.                 FullSizePic.ImageLocation = ImageDir(ImageIndex).FullName
  50.             End If
  51.         End If
  52.     End Sub
  53.     Public Sub LeaveFullScreen(ByVal targetForm As Form)
  54.         If IsFullScreen Then
  55.             ' Restore the original Window state.
  56.             targetForm.WindowState = FormWindowState.Normal
  57.             targetForm.FormBorderStyle = FormBorderStyle.None
  58.             targetForm.TopMost = topMost
  59.             targetForm.Bounds = bounds
  60.  
  61.             IsFullScreen = False
  62.             Timer1.Enabled = False
  63.             targetForm.Close()
  64.         End If
  65.     End Sub
  66.     Public Sub EnterFullScreen(ByVal targetForm As Form)
  67.         If Not IsFullScreen Then
  68.             targetForm.WindowState = FormWindowState.Maximized
  69.             targetForm.FormBorderStyle = FormBorderStyle.None
  70.             targetForm.TopMost = True
  71.             targetForm.Bounds = Screen.GetBounds(targetForm)
  72.             IsFullScreen = True
  73.         End If
  74.     End Sub
  75.  
  76.     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  77.         GetnextImage()
  78.     End Sub
  79.     Private Sub frm_keydown()
  80.         LeaveFullScreen(frm)
  81.     End Sub
  82.     Private Sub ExitToolStripMenuItem_Click()
  83.         LeaveFullScreen(frm)
  84.     End Sub
  85.     Private Sub Pic1_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs)
  86.        
  87.     End Sub
  88.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  89.         SplashScreen1.BarLong(100)
  90.         Dim i As Integer = 0
  91.         While i <= 100
  92.             SplashScreen1.ShowBar(i)
  93.             i += 1
  94.             Threading.Thread.Sleep(100)
  95.         End While
  96.  
  97.     End Sub
  98. End Class
Add Comment
Please, Sign In to add comment