Utilisation d'une progressBar
Bonsoir à tous
Pour ouvrir un form qui se nomme 'VisuAffches' j'utilise un menu qui se trouve dans un form principal
Hors visuaffiches est assez long à s'afficher
Aussi je voudrai mettre une progressbar pour patienter
Mais je ne sais pas où la placer : dans le menu principal ou dans la form visuaffiches
Pour info je vous mets les codes
Code:
1 2 3
| Private Sub AffichesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AffichesToolStripMenuItem.Click
VisuAffiches.Show()
End Sub |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
| Private Sub LstFill(ByVal ipath As String)
ipath = "C:\AffichesModifs"
Dim xx As Integer = 0
Try
Dim ist As String
Dim i As Integer = 0
Dim opt As System.IO.SearchOption = System.IO.SearchOption.TopDirectoryOnly
Me.Cursor = Cursors.WaitCursor
With lstvItem
.BeginUpdate()
.Clear()
End With
imglst.Images.Clear()
ReDim imgPaths(0)
For Each ist In Directory.GetFiles(ipath, "*", opt)
If ftype.Contains(Path.GetExtension(ist)) = True Then
ReDim Preserve imgPaths(i)
imgPaths(i) = ist
Select Case Path.GetExtension(ist)
Case Is = ".jpg", ".jpeg"
imglst.Images.Add(My.Resources.jpg)
End Select
With lstvItem
.Items.Add(Path.GetFileNameWithoutExtension(ist), i)
.Items.Item(i).SubItems.Add(ist)
End With
xx += 1
i += 1
End If
Next
Me.Cursor = Cursors.Arrow
lstvItem.EndUpdate()
Application.DoEvents()
If Me.lstvItem.Items.Count <> 0 Then
For i = 0 To imglst.Images.Count - 1
Dim img As Image = Image.FromFile(imgPaths(i))
Dim w As Double = img.Width / 5
Dim h As Double = img.Height / 5
imglst.Images.Item(i) = Image.FromFile(imgPaths(i)).GetThumbnailImage(w, h, Nothing, IntPtr.Zero)
ListBox1.Items.Add(imgPaths(i))
lstvItem.RedrawItems(i, i, True)
Application.DoEvents()
Next
End If
Catch ex As Exception
End Try
If lstvItem.Items.Count <> 0 Then
End If
End Sub |
Code:
1 2 3
| Private Sub VisuAffiches_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
LstFill(ipath)
End Sub |
Merci de bien vouloir me guider