IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VB.NET Discussion :

probleme RangeColor en débogage du from


Sujet :

VB.NET

  1. #1
    Membre actif
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2018
    Messages
    279
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2018
    Messages : 279
    Points : 239
    Points
    239
    Par défaut probleme RangeColor en débogage du from
    Bonjour,

    le problème quand je débogage ma classe qui s'appelle DemiCircleColor les couleurs sont enlever (voir image).
    Nom : clearcolor.png
Affichages : 88
Taille : 2,9 Ko

    en manuelle sens débogage en ajoutant des couleurs dans RangesColor (Voir image)
    Nom : RangeColor.png
Affichages : 82
Taille : 5,3 Ko

    ma classe :
    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
    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
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    Imports System.Drawing.Drawing2D
     
    Public Class DemiCircleColor : Inherits Control
     
        Private _Tickness As Integer
        Public Property Tickness As Integer
            Get
                Return _Tickness
            End Get
            Set(value As Integer)
                _Tickness = value : Invalidate()
            End Set
        End Property
     
        Private _RangesColor As RangeCollection
        Public ReadOnly Property RangesColor As RangeCollection
            Get
                Return _RangesColor
            End Get
        End Property
     
        Private startAngle As Single = 180
        Private endAngle As Single = 180
        Private minValue As Double = 0
        Private maxValue As Double = 100
     
        Public Sub New()
            SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.ResizeRedraw Or ControlStyles.DoubleBuffer Or ControlStyles.SupportsTransparentBackColor, True)
            Me.BackColor = Color.Transparent
            Me.MaximumSize = New Size(220, 180)
            Me.MinimumSize = New Size(220, 180)
            Me._RangesColor = New RangeCollection(Me)
            Me._Tickness = 50
        End Sub
     
        Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
            e.Graphics.SmoothingMode = SmoothingMode.AntiAlias
            DrawBackground(e.Graphics)
            DrawZones(e.Graphics)
        End Sub
     
        Protected Overridable Sub DrawBackground(ByVal g As Graphics)
            Using br As New SolidBrush(Me.BackColor)
                g.FillRectangle(br, Me.ClientRectangle)
            End Using
        End Sub
     
        Protected Overridable Sub DrawZones(ByVal g As Graphics)
            Dim rc As New Rectangle(25, 50, Me.Width - _Tickness, Me.Height - 1)
            g.SmoothingMode = SmoothingMode.AntiAlias
            g.DrawArc(New Pen(New SolidBrush(Color.LightGray), _Tickness), rc, startAngle, endAngle)
            For Each zone As RangeColor In Me._RangesColor
                If (zone.EndValue > zone.StartValue) Then
                    Using path As New GraphicsPath()
                        Using pen As New Pen(zone.Color, _Tickness)
                            Dim startPathAngle As Single = (startAngle + (((zone.StartValue - Me.minValue) * endAngle) / (Me.maxValue - Me.minValue)))
                            Dim EndPathAngle As Single = (((zone.EndValue - zone.StartValue) * endAngle) / (Me.maxValue - Me.minValue))
                            path.AddArc(rc, startPathAngle, EndPathAngle)
                            g.DrawPath(pen, path)
                        End Using
                    End Using
                End If
            Next
        End Sub
     
        Sub RepaintControl()
            Me.Refresh()
        End Sub
     
    End Class
     
    Public Class RangeCollection : Inherits CollectionBase
     
        Private Owner As DemiCircleColor
        Public Sub New(ByVal sender As DemiCircleColor)
            Owner = sender
        End Sub
     
        Default Public ReadOnly Property Item(ByVal index As Integer) As RangeColor
            Get
                Return CType(List(index), RangeColor)
            End Get
        End Property
     
        Public Function Contains(ByVal itemType As RangeColor) As Boolean
            Return List.Contains(itemType)
        End Function
     
        Public Function Add(ByVal itemType As RangeColor) As Integer
            itemType.SetOwner(Owner)
            If String.IsNullOrEmpty(itemType.Name) Then itemType.Name = GetUniqueName()
            Return List.Add(itemType)
        End Function
     
        Public Sub Remove(ByVal itemType As RangeColor)
            List.Remove(itemType)
        End Sub
     
        Public Sub Insert(ByVal index As Integer, ByVal itemType As RangeColor)
            itemType.SetOwner(Owner)
            If String.IsNullOrEmpty(itemType.Name) Then itemType.Name = GetUniqueName()
            List.Insert(index, itemType)
        End Sub
     
        Public Function IndexOf(ByVal itemType As RangeColor) As Integer
            Return List.IndexOf(itemType)
        End Function
     
        Public Function FindByName(ByVal name As String) As RangeColor
            For Each ptrRange As RangeColor In List
                If ptrRange.Name = name Then Return ptrRange
            Next
            Return Nothing
        End Function
     
        Protected Overrides Sub OnInsert(ByVal index As Integer, ByVal value As Object)
            If String.IsNullOrEmpty((CType(value, RangeColor)).Name) Then CType(value, RangeColor).Name = GetUniqueName()
            MyBase.OnInsert(index, value)
            CType(value, RangeColor).SetOwner(Owner)
        End Sub
     
        Protected Overrides Sub OnRemove(ByVal index As Integer, ByVal value As Object)
            If Owner IsNot Nothing Then Owner.RepaintControl()
        End Sub
     
        Protected Overrides Sub OnClear()
            If Owner IsNot Nothing Then Owner.RepaintControl()
        End Sub
     
        Private Function GetUniqueName() As String
            Dim Prefix As String = "Range"
            Dim index As Integer = 1
            Dim valid As Boolean
            While Me.Count <> 0
                valid = True
                For x = 0 To Me.Count - 1
                    If Me(x).Name = (Prefix & index.ToString()) Then
                        valid = False
                        Exit For
                    End If
                Next
                If valid Then Exit While
                index += 1
            End While
            Return Prefix & index.ToString()
        End Function
    End Class
     
    Public Class RangeColor
     
        Private _Color As Color
        Private _StartValue As Single
        Private _EndValue As Single
        Public Property Name As String
        Private Owner As DemiCircleColor
     
        Public Sub New()
            Me._Color = Drawing.Color.Lime
        End Sub
     
        Public Sub New(ByVal color As Color, ByVal startValue As Single, ByVal endValue As Single)
            color = color
            _StartValue = startValue
            _EndValue = endValue
        End Sub
     
        Public Sub SetOwner(ByVal value As DemiCircleColor)
            Owner = value
        End Sub
     
        Private Sub NotifyOwner()
            If Owner IsNot Nothing Then Owner.RepaintControl()
        End Sub
     
        Public Property Color As Color
            Get
                Return _Color
            End Get
            Set(ByVal value As Color)
                _Color = value
                NotifyOwner()
            End Set
        End Property
     
        Public Property StartValue As Single
            Get
                Return _StartValue
            End Get
            Set(ByVal value As Single)
                If value < _EndValue Then
                    _StartValue = value
                    NotifyOwner()
                End If
            End Set
        End Property
     
        Public Property EndValue As Single
            Get
                Return _EndValue
            End Get
            Set(ByVal value As Single)
                If value > _StartValue Then
                    _EndValue = value
                    NotifyOwner()
                End If
            End Set
        End Property
    End Class
    J'arrive pas à comprendre pourquoi en débogage du from1 les couleurs sont enlever? merci d'avance

  2. #2
    Membre expérimenté
    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    1 126
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 1 126
    Points : 1 636
    Points
    1 636
    Par défaut
    résolu ? comment ?

  3. #3
    Membre actif
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2018
    Messages
    279
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2018
    Messages : 279
    Points : 239
    Points
    239
    Par défaut
    Bonjour umfred,

    j'ai fait séparément un range couleur, startangle, endrange.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    Private _RangeColor As Color() = {Color.Green, Color.Yellow, Color.Red}
    Public Property RangeColor As Color
    ...etc
    Private _RangeEndValue As Single() = {60, 80, 100}
    Public Property RangeEndValue As Single
    ...etc
    Private _RangeStartValue As Single() = {0, 60, 80}
    Public Property RangeStartValue As Single
    ...etc
    Attention dans startPathAngle et EndPathAngle, il y a un problème angle de couleur mais j'ai résolu le problème.
    voici en image ce que ça donne :
    Nom : demcircle.png
Affichages : 44
Taille : 6,6 Ko

    si vous êtes intéresser comment j'ai fait. dit le moi je partagerai ma classe. cordialement

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. probleme librairies : in file included from
    Par Yehrr dans le forum C++
    Réponses: 3
    Dernier message: 16/05/2012, 19h41
  2. [Débutant] probleme lors du débogage de mon programme
    Par jeremyvb11 dans le forum VB.NET
    Réponses: 13
    Dernier message: 04/01/2012, 12h00
  3. Réponses: 2
    Dernier message: 21/11/2008, 00h53
  4. Probleme avec select distinct row from .
    Par jean christophe dans le forum Requêtes
    Réponses: 4
    Dernier message: 08/10/2008, 19h17
  5. Réponses: 2
    Dernier message: 18/02/2006, 09h20

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo