Bonjour à tous,
Savez vous comment on fait pour afficher du texte dans une ProgressBar ?
J'ai essayé ceci mais le texte disparaît entre 2 progressions :
Merci beaucoup si vous pouvez m'aider.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 Public Class frmRestartProcess Dim TimeMaxi As Integer = 10 Dim CurrentTime As Integer = 0 Private Sub frmRestartProcess_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load ProgressBar1.Maximum = TimeMaxi ProgressBar1.Value = 0 Timer1.Interval = 1000 Timer1.Start() End Sub Private Sub Timer1_Tick(sender As Object, e As System.EventArgs) Handles Timer1.Tick If CurrentTime = TimeMaxi Then DialogResult = Windows.Forms.DialogResult.Yes Me.Close() Exit Sub End If CurrentTime += 1 ProgressBar1.Value = CurrentTime Dim myString As String = ((ProgressBar1.Value * 100) \ ProgressBar1.Maximum).ToString() myString &= "% Done" Dim canvas As Graphics = Me.ProgressBar1.CreateGraphics canvas.DrawString(myString, New Font("Verdana", 8, FontStyle.Regular), New SolidBrush(Color.Red), 90, 4) canvas.Dispose() End Sub End Class








Répondre avec citation
Partager