ProgressBar Vertical personnalisé

Résolu
Karin.code Messages postés 183 Date d'inscription vendredi 2 septembre 2016 Statut Membre Dernière intervention 16 janvier 2018 - 27 janv. 2017 à 19:18
vb95 Messages postés 3472 Date d'inscription samedi 11 janvier 2014 Statut Contributeur Dernière intervention 13 avril 2024 - 10 févr. 2021 à 12:10
Bonsoir,
j'ai trouvé un code me permettant de créer une ProgressBar Horizontale personnel, je l'ai un petit peu modifié pour correspondre à mon style. Voici le code :
Imports System
Imports System.Drawing
Imports System.Drawing.Imaging
Imports System.Drawing.Drawing2D
Imports System.Collections.Generic
Public Class ProgressBarN : Inherits Control
#Region " Control Help - Properties & Flicker Control "
Private OFS As Integer = 0
Private Speed As Integer = 50
Private _Maximum As Integer = 100
Public Property Maximum() As Integer
Get
Return _Maximum
End Get
Set(ByVal v As Integer)
Select Case v
Case Is < _Value
_Value = v
End Select
_Maximum = v
Invalidate()
End Set
End Property
Private _Value As Integer = 0
Public Property Value() As Integer
Get
Select Case _Value
Case 0
Return 1
Case Else
Return _Value
End Select
End Get
Set(ByVal v As Integer)
Select Case v
Case Is > _Maximum
v = _Maximum
End Select
_Value = v
Invalidate()
End Set
End Property
Private _BorderStyle As Boolean = False
Private _BorderColor As Color = Color.Black
Public Property BorderColor() As Color
Get
Return _BorderColor
End Get
Set(ByVal Value As Color)
If Value <> _BorderColor Then
_BorderColor = Value
Me.Refresh()
If _BorderStyle Then
Me.Invalidate()
End If
End If
End Set
End Property
Private _RibbonStyle1 As Boolean = False
Private _RibbonColor1 As Color = Color.FromArgb(255, 35, 4)
Public Property RibbonColor1() As Color
Get
Return _RibbonColor1
End Get
Set(ByVal Value As Color)
If Value <> _RibbonColor1 Then
_RibbonColor1 = Value
Me.Refresh()
If _RibbonStyle1 Then
Me.Invalidate()
End If
End If
End Set
End Property
Private _RibbonStyle2 As Boolean = False
Private _RibbonColor2 As Color = Color.FromArgb(255, 0, 0)
Public Property RibbonColor2() As Color
Get
Return _RibbonColor2
End Get
Set(ByVal Value As Color)
If Value <> _RibbonColor2 Then
_RibbonColor2 = Value
Me.Refresh()
If _RibbonStyle2 Then
Me.Invalidate()
End If
End If
End Set
End Property
Private _TextVisibel As Boolean = True
Public Property TextVisibel() As Boolean
Get
Return _TextVisibel
End Get
Set(ByVal Value As Boolean)
If Value <> _TextVisibel Then
_TextVisibel = Value
Me.Refresh()
If _TextVisibel Then
Me.Invalidate()
End If
End If
End Set
End Property

Protected Overrides Sub CreateHandle()
MyBase.CreateHandle()
Dim T As New Threading.Thread(AddressOf Animate)
T.IsBackground = True
T.Start()
End Sub
Sub Animate()
While True
If OFS <= Width Then : OFS += 1
Else : OFS = 0
End If
Invalidate()
Threading.Thread.Sleep(Speed)
End While
End Sub
#End Region
Sub New()
MyBase.New()
Me.BackColor = Color.FromArgb(38, 38, 38)
DoubleBuffered = True
End Sub
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
Dim G As Graphics = e.Graphics
MyBase.OnPaint(e)
Dim intValue As Integer = CInt(_Value / _Maximum * Width)
G.Clear(Me.BackColor)
Dim backGrad As New LinearGradientBrush(New Rectangle(1, 1, intValue - 1, Height - 2), _
Color.FromArgb(10, 9, 8), Color.FromArgb(31, 29, 26), 90S)
G.FillRectangle(backGrad, New Rectangle(1, 1, intValue - 1, Height - 2))
Dim hatch As New HatchBrush(HatchStyle.WideUpwardDiagonal, Me.RibbonColor1, Me.RibbonColor2)
G.RenderingOrigin = New Point(OFS, 0)
G.FillRectangle(hatch, New Rectangle(1, 1, intValue - 2, Height - 2))
Dim glossGradient As New LinearGradientBrush(New Rectangle(1, 1, intValue - 2, Height / 2 - 1), Color.FromArgb(80, Color.White), Color.FromArgb(50, Color.White), 90S)
G.FillRectangle(glossGradient, New Rectangle(1, 1, intValue - 2, Height / 2 - 1))
If _TextVisibel = True Then
e.Graphics.DrawString(CInt(_Value * 100 / _Maximum) & " %", New Font("Century Gothic", 15), New SolidBrush(Color.Orange), New RectangleF(3, 3, Width - 5, Height - 5), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
Else
e.Graphics.DrawString(" ", New Font("Century Gothic", 15), New SolidBrush(Color.Orange), New RectangleF(3, 3, Width - 5, Height - 5), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
End If
G.DrawRectangle(New Pen(_BorderColor, 2), 1, 1, Me.Width - 2, Me.Height - 2) 'Ajoute un cadre sur le dessin du Panel
End Sub
End Class

je voulais créer une ProgressBar vertical mais La ProgressBar se charge du haut vers le bas, j'arrive vraiment pas à la charge du bas vers le haut. Voici le code :
Public Class ProgressBarV : Inherits Control
#Region " Control Help - Properties & Flicker Control "
Private OFS As Integer = Width
Private Speed As Integer = 50
Private _Maximum As Integer = 100
Public Property Maximum() As Integer
Get
Return _Maximum
End Get
Set(ByVal v As Integer)
Select Case v
Case Is < _Value
_Value = v
End Select
_Maximum = v
Invalidate()
End Set
End Property
Private _Value As Integer = 0
Public Property Value() As Integer
Get
Select Case _Value
Case 0
Return 1
Case Else
Return _Value
End Select
End Get
Set(ByVal v As Integer)
Select Case v
Case Is > _Maximum
v = _Maximum
End Select
_Value = v
Invalidate()
End Set
End Property
Private _BorderStyle As Boolean = False
Private _BorderColor As Color = Color.Black 'Color.FromArgb(45, 45, 45)
Public Property BorderColor() As Color
Get
Return _BorderColor
End Get
Set(ByVal Value As Color)
If Value <> _BorderColor Then
_BorderColor = Value
Me.Refresh()
If _BorderStyle Then
Me.Invalidate()
End If
End If
End Set
End Property
Private _RibbonStyle1 As Boolean = False
Private _RibbonColor1 As Color = Color.FromArgb(255, 35, 4)
Public Property RibbonColor1() As Color
Get
Return _RibbonColor1
End Get
Set(ByVal Value As Color)
If Value <> _RibbonColor1 Then
_RibbonColor1 = Value
Me.Refresh()
If _RibbonStyle1 Then
Me.Invalidate()
End If
End If
End Set
End Property
Private _RibbonStyle2 As Boolean = False
Private _RibbonColor2 As Color = Color.FromArgb(255, 0, 0)
Public Property RibbonColor2() As Color
Get
Return _RibbonColor2
End Get
Set(ByVal Value As Color)
If Value <> _RibbonColor2 Then
_RibbonColor2 = Value
Me.Refresh()
If _RibbonStyle2 Then
Me.Invalidate()
End If
End If
End Set
End Property
Protected Overrides Sub CreateHandle()
MyBase.CreateHandle()
Dim T As New Threading.Thread(AddressOf Animate)
T.IsBackground = True
T.Start()
End Sub
Sub Animate()
While True
If OFS <= Width Then : OFS -= 1
Else : OFS = 0
End If
Invalidate()
Threading.Thread.Sleep(Speed)
End While
End Sub
#End Region
Sub New()
MyBase.New()
Me.BackColor = Color.FromArgb(38, 38, 38)
DoubleBuffered = True
End Sub
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
Dim G As Graphics = e.Graphics
MyBase.OnPaint(e)
Dim intValue As Integer = CInt(_Value / _Maximum * Height)
G.Clear(Me.BackColor)
Dim backGrad As New LinearGradientBrush(New Rectangle(1, Height - 2, Width - 1, Height - intValue - 2), _
Color.Red, Color.FromArgb(31, 29, 26), 70S) '10, 9, 8
Dim hatch As New HatchBrush(HatchStyle.WideUpwardDiagonal, Me.RibbonColor1, Me.RibbonColor2)
G.RenderingOrigin = New Point(0, OFS)
G.FillRectangle(hatch, New Rectangle(1, 1, Width - 2, intValue - 2))
G.DrawRectangle(New Pen(_BorderColor, 2), 1, 1, Me.Width - 2, Me.Height - 2) 'Ajoute un cadre sur le dessin du Panel
End Sub
End Class

merci de m'aider pour résoudre ce problème
A voir également:

7 réponses

vb95 Messages postés 3472 Date d'inscription samedi 11 janvier 2014 Statut Contributeur Dernière intervention 13 avril 2024 169
27 janv. 2017 à 21:54
bonsoir
A tester ( aucune certitude) mais c'est ce qui me paraît logique
change cette ligne dans ta procédure
Dim intValue As Integer = CInt(_Value / _Maximum * Height)

par
Dim intValue As Integer = CInt((Maximum - _Value) / _Maximum * Height)
0
Karin.code Messages postés 183 Date d'inscription vendredi 2 septembre 2016 Statut Membre Dernière intervention 16 janvier 2018 2
27 janv. 2017 à 22:32
Bonsoir Vb95,
merci pour ta réponse
quand je remplace la partie que tu as mentionné, La ProgresseBar se charge comme ça :

mais normalement elle doit se charger de cette façon :
0
vb95 Messages postés 3472 Date d'inscription samedi 11 janvier 2014 Statut Contributeur Dernière intervention 13 avril 2024 169
27 janv. 2017 à 23:20
Si je comprends bien elle se charge bien du bas vers le haut mais avec les mauvaises couleurs
Dans le dessin du bas le rouge va de 0% à gauche vers 100% à droite ( et c'est ce que tu veux )
Dans le dessin du haut c'est le noir qui suit cette même progression
Si tu inversait les couleurs cela sera solutionné : inverse les 2 valeurs de _RibbonColor1 et _RibbonColor2 aux lignes 55 et 71
0
kikou93 Messages postés 417 Date d'inscription mardi 4 février 2014 Statut Membre Dernière intervention 24 septembre 2018 1
Modifié par kikou93 le 28/01/2017 à 10:08
Bonjour
ici
 (1, 1, Width - 2, intValue - 2))
ça commence de 1,1 je sais pas si ça fonctionne mais pourquoi tu me fais pas ça 1,Height
0
Karin.code Messages postés 183 Date d'inscription vendredi 2 septembre 2016 Statut Membre Dernière intervention 16 janvier 2018 2
28 janv. 2017 à 11:09
Bonjour Kikou93,
Si je fais comme tu à mentionner les couleurs ne s'affiche même pas
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
Karin.code Messages postés 183 Date d'inscription vendredi 2 septembre 2016 Statut Membre Dernière intervention 16 janvier 2018 2
28 janv. 2017 à 11:08
Bonjour Vb95,
Comme tu n'as pas tester le code, tu n'as pas dû l'avoir remarqué que la _RibbonColor1 et la _RibbonColor2 ne sont pas les couleurs de la partie rouge et la partie gris foncé ils sont les deux couleurs de la partie rouge, par exemple si je mets comme ça :
_RibbonColor1 = Color.Blue
_RibbonColor2 = Color.Green

j'ai remarqué que avec le code que tu m'as donné que la ProgresseBar n'est pas en train de se charger mais de se décharger
0
vb95 Messages postés 3472 Date d'inscription samedi 11 janvier 2014 Statut Contributeur Dernière intervention 13 avril 2024 169
28 janv. 2017 à 14:14
bonjour Karin.code
Je ne sais pas comment tester ton code !
C'est un contrôle personnalisé ( un UserControl comme on dit)
Je sèche
0
Karin.code Messages postés 183 Date d'inscription vendredi 2 septembre 2016 Statut Membre Dernière intervention 16 janvier 2018 2
28 janv. 2017 à 17:30
Bonsoir Vb95,
Je ne sais pas comment tester ton code !
tu peux le tester sans problème, tu n'as qu'à copier le code dans un nouveau classe, enregistrer le projet et le générique alors le contrôle apparaîtra dans La Boîte à outils tu lui donnes une taille par exemple (40;100)
0
vb95 Messages postés 3472 Date d'inscription samedi 11 janvier 2014 Statut Contributeur Dernière intervention 13 avril 2024 169 > Karin.code Messages postés 183 Date d'inscription vendredi 2 septembre 2016 Statut Membre Dernière intervention 16 janvier 2018
Modifié par vb95 le 28/01/2017 à 18:58
Bonsoir Karin.code
C'est bon : j'ai réussi à utiliser la progressbar

Pour tester une Form avec la ProgressBar (ProgressBarV1), un label (Label1)et un Bouton (Button1)
Le bouton sert à donner des valeurs aléatoires entre 0 et 100 pour la barre de progression
Entre parenthèses le nom des contrôles
Ce code dans la Form

Public Class Form1

Dim alea As New Random

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

ProgressBarV1.Value = 10

End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

ProgressBarV1.Value = alea.Next(0, 100)
Label1.Text = ProgressBarV1.Value.ToString

End Sub

End Class


Et le principal : la ligne à modifier dans la class ProgressBarV
C'est celle avec G.FillRectangle

G.FillRectangle(hatch, New Rectangle(1, Height - intValue, Width - 2, intValue - 2)) ' ligne modifiée
0
Karin.code Messages postés 183 Date d'inscription vendredi 2 septembre 2016 Statut Membre Dernière intervention 16 janvier 2018 2 > vb95 Messages postés 3472 Date d'inscription samedi 11 janvier 2014 Statut Contributeur Dernière intervention 13 avril 2024
28 janv. 2017 à 20:41
Bonsoir Vb95,
merci les codes fonction très bien
Voici le code complet si quelqu'un en a besoin :
Imports System
Imports System.Drawing
Imports System.Drawing.Imaging
Imports System.Drawing.Drawing2D
Imports System.Collections.Generic
Public Class ProgressBarV : Inherits Control
#Region " Control Help - Properties & Flicker Control "
Private OFS As Integer = Width
Private Speed As Integer = 50
Private _Maximum As Integer = 100
Public Property Maximum() As Integer
Get
Return _Maximum
End Get
Set(ByVal v As Integer)
Select Case v
Case Is < _Value
_Value = v
End Select
_Maximum = v
Invalidate()
End Set
End Property
Private _Value As Integer = 0
Public Property Value() As Integer
Get
Select Case _Value
Case 0
Return 1
Case Else
Return _Value
End Select
End Get
Set(ByVal v As Integer)
Select Case v
Case Is > _Maximum
v = _Maximum
End Select
_Value = v
Invalidate()
End Set
End Property
Private _BorderStyle As Boolean = False
Private _BorderColor As Color = Color.Black 'Color.FromArgb(45, 45, 45)
Public Property BorderColor() As Color
Get
Return _BorderColor
End Get
Set(ByVal Value As Color)
If Value <> _BorderColor Then
_BorderColor = Value
Me.Refresh()
If _BorderStyle Then
Me.Invalidate()
End If
End If
End Set
End Property
Private _RibbonStyle1 As Boolean = False
Private _RibbonColor1 As Color = Color.Blue 'Color.FromArgb(255, 35, 4)
Public Property RibbonColor1() As Color
Get
Return _RibbonColor1
End Get
Set(ByVal Value As Color)
If Value <> _RibbonColor1 Then
_RibbonColor1 = Value
Me.Refresh()
If _RibbonStyle1 Then
Me.Invalidate()
End If
End If
End Set
End Property
Private _RibbonStyle2 As Boolean = False
Private _RibbonColor2 As Color = Color.Green ' Color.FromArgb(255, 0, 0)
Public Property RibbonColor2() As Color
Get
Return _RibbonColor2
End Get
Set(ByVal Value As Color)
If Value <> _RibbonColor2 Then
_RibbonColor2 = Value
Me.Refresh()
If _RibbonStyle2 Then
Me.Invalidate()
End If
End If
End Set
End Property
Protected Overrides Sub CreateHandle()
MyBase.CreateHandle()
Dim T As New Threading.Thread(AddressOf Animate)
T.IsBackground = True
T.Start()
End Sub
Sub Animate()
While True
If OFS <= Width Then : OFS -= 1
Else : OFS = 0
End If
Invalidate()
Threading.Thread.Sleep(Speed)
End While
End Sub
#End Region
Sub New()
MyBase.New()
Me.BackColor = Color.FromArgb(38, 38, 38)
DoubleBuffered = True
End Sub
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
Dim G As Graphics = e.Graphics
MyBase.OnPaint(e)
Dim intValue As Integer = CInt(_Value / _Maximum * Height)
G.Clear(Me.BackColor)
Dim hatch As New HatchBrush(HatchStyle.WideUpwardDiagonal, _RibbonColor1, _RibbonColor2)
G.RenderingOrigin = New Point(0, OFS)
G.FillRectangle(hatch, New Rectangle(1, Height - intValue, Width - 2, intValue - 2)) ' ligne modifiée
G.DrawRectangle(New Pen(Color.Red, 2), 1, 1, Me.Width - 2, Me.Height - 2) 'Ajoute un cadre sur le dessin du Panel
End Sub
End Class

j'ai aussi créer une ProgressBar circulaire, si cela ne te dérange pas peux-tu vérifier si j'ai fait des erreurs
Imports System
Imports System.Drawing
Imports System.Drawing.Imaging
Imports System.Drawing.Drawing2D
Imports System.Collections.Generic
Public Class ProgressBarCirculaire : Inherits Control
#Region " Control Help - Properties & Flicker Control "
Private _Texte As String = " %"
Private OFS As Integer = 0
Private Angle As Integer = 0
Private Speed As Integer = 50
Private _Maximum As Integer = 100
Public Property Maximum() As Integer
Get
Return _Maximum
End Get
Set(ByVal v As Integer)
Select Case v
Case Is < _Value
_Value = v
End Select
_Maximum = v
Invalidate()
End Set
End Property
Private _Value As Integer = 0
Public Property Value() As Integer
Get
Select Case _Value
Case 0
Return 0
Case Else
Return _Value
End Select
End Get
Set(ByVal v As Integer)
Select Case v
Case Is > _Maximum
v = _Maximum
End Select
_Value = v
Invalidate()
End Set
End Property
Private _BorderStyle As Boolean = False
Private _BorderColor As Color = Color.Black
Public Property BorderColor() As Color
Get
Return _BorderColor
End Get
Set(ByVal Value As Color)
If Value <> _BorderColor Then
_BorderColor = Value
Me.Refresh()
If _BorderStyle Then
Me.Invalidate()
End If
End If
End Set
End Property
Private _RibbonStyle1 As Boolean = False
Private _RibbonColor1 As Color = Color.FromArgb(225, 28, 55)
Public Property RibbonColor1() As Color
Get
Return _RibbonColor1
End Get
Set(ByVal Value As Color)
If Value <> _RibbonColor1 Then
_RibbonColor1 = Value
Me.Refresh()
If _RibbonStyle1 Then
Me.Invalidate()
End If
End If
End Set
End Property
Private _RibbonStyle2 As Boolean = False
Private _RibbonColor2 As Color = Color.Gray
Public Property RibbonColor2() As Color
Get
Return _RibbonColor2
End Get
Set(ByVal Value As Color)
If Value <> _RibbonColor2 Then
_RibbonColor2 = Value
Me.Refresh()
If _RibbonStyle2 Then
Me.Invalidate()
End If
End If
End Set
End Property
Private _TextVisibel As Boolean = True
Public Property TextVisibel() As Boolean
Get
Return _TextVisibel
End Get
Set(ByVal Value As Boolean)
If Value <> _TextVisibel Then
_TextVisibel = Value
Me.Refresh()
If _TextVisibel Then
Me.Invalidate()
End If
End If
End Set
End Property

Protected Overrides Sub CreateHandle()
MyBase.CreateHandle()
Dim T As New Threading.Thread(AddressOf Animate)
T.IsBackground = True
T.Start()
End Sub
Sub Animate()
While True
If Angle < 360 Then : Angle = CInt(_Value * 360 / _Maximum)
'Else : Angle = 0

End If
Invalidate()
Threading.Thread.Sleep(Speed)
End While
End Sub
#End Region
Sub New()
MyBase.New()
Me.Text = _Texte
Me.BackColor = Color.FromArgb(38, 38, 38)
Me.Font = New Font("Century Gothic", 14)
Me.MinimumSize = New Size(100, 100)
Me.BackColor = SystemColors.Control
Me.Value = 0

DoubleBuffered = True
End Sub
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
Dim G As Graphics = e.Graphics
MyBase.OnPaint(e)
Dim intValue As Integer = CInt(_Value / _Maximum * Width)
G.Clear(Me.BackColor)
e.Graphics.FillEllipse(New SolidBrush(Color.FromArgb(37, 46, 59)), 12, 12, Width - 24, Height - 24)
e.Graphics.DrawArc(New Pen(New SolidBrush(Color.Gray), 5), 10, 10, Width - 20, Height - 20, -90, 360)
e.Graphics.DrawArc(New Pen(New SolidBrush(_BorderColor), 3), 7, 7, Width - 14, Height - 14, 0, 360) ' la progressBar Circulaire vide

e.Graphics.DrawString(CInt((Angle * 100) / 360) & Me.Text, New Font("Century Gothic", 20), New SolidBrush(Color.FromArgb(225, 28, 55)), New RectangleF(3, 3, Width - 5, Height - 5), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
e.Graphics.DrawArc(New Pen(New SolidBrush(_RibbonColor1), 5), 10, 10, Width - 20, Height - 20, -90, Angle)
End Sub
End Class

merci encore
0
vb95 Messages postés 3472 Date d'inscription samedi 11 janvier 2014 Statut Contributeur Dernière intervention 13 avril 2024 169 > Karin.code Messages postés 183 Date d'inscription vendredi 2 septembre 2016 Statut Membre Dernière intervention 16 janvier 2018
28 janv. 2017 à 22:29
La progresse barre circulaire c'est juste pour le fun !
Je ne vois guère l'utilité de cette forme particulière au niveau strictement " barre de progression"
0
vb95 Messages postés 3472 Date d'inscription samedi 11 janvier 2014 Statut Contributeur Dernière intervention 13 avril 2024 169 > vb95 Messages postés 3472 Date d'inscription samedi 11 janvier 2014 Statut Contributeur Dernière intervention 13 avril 2024
Modifié par vb95 le 29/01/2017 à 00:41
J'ai testé ta progressbar circulaire

Je te propose ceci pour la procédure OnPaint de ta classe ProgressBarV

Dim G As Graphics = e.Graphics
MyBase.OnPaint(e)
Dim intValue As Integer = CInt(_Value / _Maximum * Width)
With G
.Clear(Me.BackColor)
.FillEllipse(New SolidBrush(Color.White), 12, 12, Width - 24, Height - 24)
.DrawArc(New Pen(New SolidBrush(Color.Gray), 18), 10, 10, Width - 20, Height - 20, -90, 360)
.DrawString(CInt((Angle * 100) / 360).ToString, New Font("Century Gothic", 20), New SolidBrush(Color.FromArgb(225, 28, 55)), New RectangleF(3, 3, Width - 5, Height - 5), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
.DrawArc(New Pen(New SolidBrush(_RibbonColor1), 12), 10, 10, Width - 20, Height - 20, -90, Angle)
End With
End Sub


- groupement des G avec With End With
- le centre est blanc et non noir : on voit mieux l'anneau de la progressbar
- j'ai supprimé le texte à l'intérieur ( seule reste la valeur en %)
- doublement de l'épaisseur de l'anneau de la progressbar circulaire

La sub Animate a été modifiée car l'angle n'est jamais supérieur à 360° ( ce qui correspond à la valeur maximale de la Progressbar )

Sub Animate()
While True
Angle = CInt(_Value * 360 / _Maximum)
Invalidate()
Threading.Thread.Sleep(Speed)
End While
End Sub


voilà le résultat de mes tests
Bonne programmation
0
Pour faire une progressbar personnalisée ou verticale il faut superposer 2 picturebox et leur donner 2 couleurs de fonds différentes. Dans le code il faut utiliser la commande:
Picturebox.height= val (progressbar ver.)
Picturebox.width=val (progreesbar hor.)
Il ne faut pas oublier de donner les mêmes dimensionner aux 2 PictureBox. Le code est facile par la suite.
0
vb95 Messages postés 3472 Date d'inscription samedi 11 janvier 2014 Statut Contributeur Dernière intervention 13 avril 2024 169
10 févr. 2021 à 12:10
BONJOUR Zakaria !
Un petit mot que tu as oublié !
0
Rejoignez-nous