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 :

Classe : récupérer une propriété d'une autre classe qui est liée mais qui n'est pas une classe mère


Sujet :

VB.NET

  1. #1
    Membre actif
    Inscrit en
    Juillet 2013
    Messages
    772
    Détails du profil
    Informations forums :
    Inscription : Juillet 2013
    Messages : 772
    Points : 275
    Points
    275
    Par défaut Classe : récupérer une propriété d'une autre classe qui est liée mais qui n'est pas une classe mère
    Bonjour,
    dans le cadre d'un autre topic, je suis en train de créer un DataGridViewTextBoxColumn personnalisé que j'ai appelé DataGridViewStarRateColumn
    Ca commence comme ça :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    Public Class DataGridViewStarRateColumn
        Inherits DataGridViewTextBoxColumn
     
     
        Private _starwidth As Integer = 20
        Private _starheigth As Integer = 20
     
        Public Sub New()
            Me.CellTemplate = New DataGridViewStarRateCell()
     
        End Sub
    S'ensuit donc une classe DataGridViewStarRateCell qui hérite de DataGridViewTextBoxCell

    Dans cette classe DataGridViewStarRateCell , j'ai besoin de définir une propriété StarHeight que je souhaiterais paramétrable par l'utilisateur dans le designer

    Comme les propriétés de DataGridViewStarRateCell ne sont pas directement accessibles dans le designer, je passe donc par les propriétés de DataGridViewStarRateColumn qui, elles, le sont. Donc j'ai défini la propriété suivant dans la classe DataGridViewStarRateColumn :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
     <Category("Design")>
        <Description("Largeur de l'étoile")>
        Public Property StarWidth() As Integer
            'Property that corresponds with the
            'starswidth variable
            Get
                Return _starwidth
            End Get
            Set(ByVal value As Integer)
                _starwidth = value
            End Set
        End Property
    Grâce à ça, je peux définir dans le designer la propriété StarHeight en même temps que j'opte pour le type DataGridViewStarRateColumn

    Maintenant, il faut que je récupère la valeur de cette propriété dans le code de ma classe DataGridViewStarRateCell.

    Si vous m'avez suivi jusque là, vous aurez compris qu'il n'y a pas de lien d'héritage entre DataGridViewStarRateCell et DataGridViewStarRateColumn
    DataGridViewStarRateCell hérite de DataGridViewTextBoxCell
    DataGridViewStarRateColumn hérite de DataGridViewTextBoxColumn
    Mais j'ai besoin de transmettre l'une des propriétés de DataGridViewStarRateColumn à DataGridViewStarRateCell

    J'ai essayé ceci qui me paraissait logique, mais ça plante carrément l'exécution :
    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
    Public Class DataGridViewStarRateColumn
        Inherits DataGridViewTextBoxColumn
     
        Private _starwidth As Integer = 20
        Private _starheigth As Integer = 20
     
        Public Sub New()
            Me.CellTemplate = New DataGridViewStarRateCell(_starheigth)
     
        End Sub
    ...
    End Class
     
    Public Class DataGridViewStarRateCell
        Inherits DataGridViewTextBoxCell
     Private _starheigth As Integer
     Public Sub New(toto as integer)
                 _starheigth = toto
        End Sub
    ..
    End Class
    Quelqu'un peut-il me dépanner ? Je suis encore très novice en matière de POO même si cela fait déjà un an que je code en VB.NET

  2. #2
    Membre expérimenté
    Homme Profil pro
    Développeur .Net / Delphi
    Inscrit en
    Juillet 2002
    Messages
    738
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Eure (Haute Normandie)

    Informations professionnelles :
    Activité : Développeur .Net / Delphi
    Secteur : Finance

    Informations forums :
    Inscription : Juillet 2002
    Messages : 738
    Points : 1 745
    Points
    1 745
    Par défaut
    Bonjour,

    Et tout simplement comme ça peut être :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    Public Property StarWidth() As Integer
        Get
            Return Me.CellTemplate.Starwidth
        End Get
        Set(ByVal value As Integer)
            Me.CellTemplate.Starwidth = value
        End Set
    End Property
    Après avoir initialisé dans le constructeur de la classe DataGridViewStarRateCell la valeur par défaut.

  3. #3
    Membre actif
    Inscrit en
    Juillet 2013
    Messages
    772
    Détails du profil
    Informations forums :
    Inscription : Juillet 2013
    Messages : 772
    Points : 275
    Points
    275
    Par défaut
    Ca ne peut pas marcher. CellTemplate n'est pas un membre de DataGridViewStarRateCell justement parce qu'il n'y a pas de lien d'héritage.

  4. #4
    Modérateur

    Homme Profil pro
    Inscrit en
    Janvier 2007
    Messages
    1 722
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Janvier 2007
    Messages : 1 722
    Points : 5 100
    Points
    5 100
    Par défaut
    Bonjour,
    Et de cette façon
    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
    Public Class DataGridViewStarRateColumn
        Inherits DataGridViewTextBoxColumn
        Private _starwidth As Integer = 20
        Private _starheigth As Integer = 20
     
        Public Sub New()
            Me.CellTemplate = New DataGridViewStarRateCell()
            DirectCast(Me.CellTemplate, DataGridViewStarRateCell).StarWidth = _starwidth
        End Sub
    End Class
     
    Public Class DataGridViewStarRateCell
        Inherits DataGridViewTextBoxCell
        Private _starheigth As Integer
        Public Sub New(toto As Integer)
            _starheigth = toto
        End Sub
        Public Sub New()
        End Sub
        Private _starwidth As Integer
        '<Category("Design")>
        <System.ComponentModel.Description("Largeur de l'étoile")>
        Public Property StarWidth() As Integer
            'Property that corresponds with the'starswidth variable
            Get
                Return _starwidth
            End Get
            Set(ByVal value As Integer)
                _starwidth = value
            End Set
        End Property
    End Class
    Traductions d'articles :
    La mémoire en .NET - Qu'est-ce qui va où ?
    Architecture DAL de haute performance et DTO ; Version C# : Partie 1,Partie 2,Partie 3 — Version VB.NET : Partie 1,Partie 2,Partie 3
    N'hésitez pas à consulter la FAQ VB.NET, le cours complet de Philippe Lasserre et tous les cours, articles et tutoriels.

  5. #5
    Membre actif
    Inscrit en
    Juillet 2013
    Messages
    772
    Détails du profil
    Informations forums :
    Inscription : Juillet 2013
    Messages : 772
    Points : 275
    Points
    275
    Par défaut
    Si je comprends bien ton idée :
    - tu définis la propriété StarWidth dans le classe DataGridViewStarRateCell
    - dans la classe DataGridViewStarRateColumn, dans la sub new, tu instancies un DataGridViewStarRateCell en lui affectant la valeur de la propriété StarWidth, cette valeur étant définie par la variable _starwidth de la classe DataGridViewStarRateColumn.

    Je vois bien l'idée, mais il y a un truc que je n'arrive pas à caler c'est
    - comment définir la valeur _starwidth de la classe DataGridViewStarRateColumn à partir du designer ? J'ai essayé en créant une propriété StarWidth dans cette classe. La propriété apparaît bien dans le designer mais n'est pas prise en compte dans l'instruction DirectCast et n'est pas mémorisée non plus dans le designer (si je quitte la fenêtre des propriétés de la colonne et que j'y reviens, la dernière valeur saisie n'a pas été mémorisée.
    - visiblement la sub new(toto as integer) n'est pas utile dans ton exemple.

  6. #6
    Modérateur

    Homme Profil pro
    Inscrit en
    Janvier 2007
    Messages
    1 722
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Janvier 2007
    Messages : 1 722
    Points : 5 100
    Points
    5 100
    Par défaut
    J'imagine ainsi, mais cela reste à voir.
    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
    Public Class DataGridViewStarRateColumn
        Inherits DataGridViewTextBoxColumn
        Private _starwidth As Integer = 20
        Private _starheigth As Integer = 20
        Public Sub New()
            Me.CellTemplate = New DataGridViewStarRateCell()
            DirectCast(Me.CellTemplate, DataGridViewStarRateCell).StarWidth = _starwidth ' par défaut
        End Sub
        <Category("Design")>
        <System.ComponentModel.Description("Largeur de l'étoile")>
        Public Property StarWidth() As Integer
            'Property that corresponds with the'starswidth variable
            Get
                Return _starwidth
            End Get
            Set(ByVal value As Integer)
                _starwidth = value
                DirectCast(Me.CellTemplate, DataGridViewStarRateCell).StarWidth = _starwidth ' attribué par le designer
            End Set
        End Property
    End Class
    [Edit] il doit aussi falloir un attribut pour marquer la sérialisation.
    Traductions d'articles :
    La mémoire en .NET - Qu'est-ce qui va où ?
    Architecture DAL de haute performance et DTO ; Version C# : Partie 1,Partie 2,Partie 3 — Version VB.NET : Partie 1,Partie 2,Partie 3
    N'hésitez pas à consulter la FAQ VB.NET, le cours complet de Philippe Lasserre et tous les cours, articles et tutoriels.

  7. #7
    Membre actif
    Inscrit en
    Juillet 2013
    Messages
    772
    Détails du profil
    Informations forums :
    Inscription : Juillet 2013
    Messages : 772
    Points : 275
    Points
    275
    Par défaut
    Bon c'était presque ça.
    Pour mémoriser les propriétés depuis le designer il faut juste passer le variables privées en shared.

    En guise de remerciement, voici ma classe complète qui gère l'alignement, les dimensions de l'étoile :

    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
    Imports System.Windows.Forms.VisualStyles
    Imports System.ComponentModel
     
    Public Class DataGridViewStarRateColumn
        Inherits DataGridViewTextBoxColumn
     
        Private Shared _starwidth As Integer = 20
        Private Shared _starheight As Integer = 20
        Private Shared _staralignment As DataGridViewContentAlignment = DataGridViewContentAlignment.TopLeft
     
     
        Public Sub New()
            Me.CellTemplate = New DataGridViewStarRateCell()
        End Sub
     
        <Category("Design")>
     <Description("Largeur de l'étoile")>
        Public Property StarWidth() As Integer
            Get
                Return _starwidth
            End Get
            Set(ByVal value As Integer)
                _starwidth = value
                DirectCast(Me.CellTemplate, DataGridViewStarRateCell).StarWidth = _starwidth
            End Set
        End Property
     
        <Category("Design")>
    <Description("Hauteur de l'étoile")>
        Public Property StarHeight() As Integer
            Get
                Return _starheight
            End Get
            Set(ByVal value As Integer)
                _starheight = value
                DirectCast(Me.CellTemplate, DataGridViewStarRateCell).StarHeight = _starheight
            End Set
        End Property
     
        <Category("Design")>
    <Description("Alignement des étoiles dans la cellule")>
        Public Property StarAlignment() As DataGridViewContentAlignment
            Get
                Return _staralignment
            End Get
            Set(ByVal value As DataGridViewContentAlignment)
                _staralignment = value
                DirectCast(Me.CellTemplate, DataGridViewStarRateCell).StarAlignment = _staralignment
            End Set
        End Property
    End Class
     
    Public Class DataGridViewStarRateCell
        Inherits DataGridViewTextBoxCell
     
        Private Shared _starwidth As Integer
        Private Shared _starheight As Integer
        Private Shared _staralignment As DataGridViewContentAlignment
     
        <Category("Design")>
       <Description("Largeur de l'étoile")>
        Public Property StarWidth() As Integer
            Get
                Return _starwidth
            End Get
            Set(ByVal value As Integer)
                _starwidth = value
     
            End Set
        End Property
     
        <Category("Design")>
     <Description("Hauteur de l'étoile")>
        Public Property StarHeight() As Integer
            Get
                Return _starheight
            End Get
            Set(ByVal value As Integer)
                _starheight = value
            End Set
        End Property
     
        <Category("Design")>
    <Description("Alignement des étoiles dans la cellule")>
        Public Property StarAlignment() As DataGridViewContentAlignment
            Get
                Return _staralignment
            End Get
            Set(ByVal value As DataGridViewContentAlignment)
                _staralignment = value
            End Set
        End Property
     
        ' Override the Clone method so that the Enabled property is copied. 
        Public Overrides Function Clone() As Object
            Dim Cell As DataGridViewStarRateCell = _
                CType(MyBase.Clone(), DataGridViewStarRateCell)
            Return Cell
        End Function
     
        Public Sub New()
        End Sub
     
     
     
        Protected Overrides Sub Paint(ByVal graphics As Graphics, _
            ByVal clipBounds As Rectangle, ByVal cellBounds As Rectangle, _
            ByVal rowIndex As Integer, _
            ByVal elementState As DataGridViewElementStates, _
            ByVal value As Object, ByVal formattedValue As Object, _
            ByVal errorText As String, _
            ByVal cellStyle As DataGridViewCellStyle, _
            ByVal advancedBorderStyle As DataGridViewAdvancedBorderStyle, _
            ByVal paintParts As DataGridViewPaintParts)
     
            MyBase.Paint(graphics, clipBounds, cellBounds, rowIndex, elementState, Nothing, Nothing, errorText, cellStyle, advancedBorderStyle, paintParts)
     
            'Set the scaling mode to high quality (makes the stars look good at any size)
            graphics.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
     
            ' dessine le nombre d'étoiles correspondant à la valeur de la cellule
            ' le dessin est limité aux dimensions de la cellule
            Dim starValue As Integer 'valeur de la note
            Dim filledtouse As Image = My.Resources.star_xxl 'une étoile
            Dim height As Integer = filledtouse.Height
            Dim width As Integer = filledtouse.Width
            Dim destRectX, destRectY, destRectWidth, destRectHeight As Integer
            Dim srcRectWidth, srcRectHeight As Integer
            Dim destRect, srcRect As Rectangle
            starValue = value
     
            ' réglage alignement des étoiles dans la cellule
            Dim offsetX, offsetY As Integer
            Select Case _staralignment
                Case DataGridViewContentAlignment.BottomCenter
                    offsetX = Math.Max(0, (cellBounds.Width - starValue * _starwidth) / 2) ' Center
                    offsetY = Math.Max(0, (cellBounds.Height - _starheight)) 'Bottom
                Case DataGridViewContentAlignment.BottomLeft
                    offsetX = 0 'left
                    offsetY = Math.Max(0, (cellBounds.Height - _starheight)) 'Bottom
                Case DataGridViewContentAlignment.BottomRight
                    offsetX = Math.Max(0, cellBounds.Width - starValue * _starwidth) 'Right
                    offsetY = Math.Max(0, (cellBounds.Height - _starheight)) 'Bottom
                Case DataGridViewContentAlignment.MiddleCenter
                    offsetX = Math.Max(0, (cellBounds.Width - starValue * _starwidth) / 2) ' Center
                    offsetY = Math.Max(0, (cellBounds.Height - _starheight) / 2) ' Middle
                Case DataGridViewContentAlignment.MiddleLeft
                    offsetX = 0 'left
                    offsetY = Math.Max(0, (cellBounds.Height - _starheight) / 2) ' Middle
                Case DataGridViewContentAlignment.MiddleRight
                    offsetX = Math.Max(0, cellBounds.Width - starValue * _starwidth) 'Right
                    offsetY = Math.Max(0, (cellBounds.Height - _starheight) / 2) ' Middle
                Case DataGridViewContentAlignment.TopCenter
                    offsetX = Math.Max(0, (cellBounds.Width - starValue * _starwidth) / 2) ' Center
                    offsetY = 0 'top
                Case DataGridViewContentAlignment.TopLeft, DataGridViewContentAlignment.NotSet
                    offsetX = 0 'left
                    offsetY = 0 'top
                Case DataGridViewContentAlignment.TopRight
                    offsetX = Math.Max(0, cellBounds.Width - starValue * _starwidth) 'Right
            End Select
     
            For i = 1 To starValue
                destRectX = cellBounds.X + offsetX + (i - 1) * _starwidth
                destRectY = cellBounds.Y + offsetY
                destRectWidth = Math.Min(_starwidth, cellBounds.Width - (i - 1) * _starwidth) - 1
                destRectHeight = Math.Min(cellBounds.Height, _starheight) - 1
                srcRectWidth = width / _starwidth * destRectWidth
                srcRectHeight = height * Math.Min(cellBounds.Height / _starheight, 1)
                destRect = New Rectangle(destRectX, destRectY, destRectWidth, destRectHeight)
                srcRect = New Rectangle(0, 0, srcRectWidth, srcRectHeight)
                graphics.DrawImage(filledtouse, destRect, srcRect, GraphicsUnit.Pixel)
            Next
     
     
        End Sub
     
    End Class
    N'hésitez pas à me faire remonter vos remarques et merci encore. J'ai bien progressé à travers cet exemple.

  8. #8
    Membre actif
    Inscrit en
    Juillet 2013
    Messages
    772
    Détails du profil
    Informations forums :
    Inscription : Juillet 2013
    Messages : 772
    Points : 275
    Points
    275
    Par défaut
    Bonjour,

    Je rouvre ce topic car, j'ai découvert 2 bogues majeurs :
    - lorsque j'affecte le type DataGridViewStarRateColumn à une colonne de DTG, tout se passe à peu près correctement. En revanche, si je change DataGridViewStarRateColumn ==> DataGridViewTextBoxColumn, le fichier Form1.designer.vb garde en mémoire les paramètres personnalisés du DataGridViewStarRateColumn. Cela pose un pb parce que si je veut supprimer la référence à ma DLL parce que je n'en ai plus l'utilité, le Form1.designer.vb possède encore quelques lignes de code qui y font référence même si elles ne sont plus utilisées.

    - plus embêtant, je croyais avoir résolu mon pb de mémorisation de variable privée _starwidth en la déclarant "Shared", mais cela pose le pb suivant : si je crée dans un DTG 2 colonnes de type DataGridViewStarRateColumn, la modification d'une des propriétés personnalisées (StarWidth, StarHeight ou StarAlignment) de l'une des colonnes entraine la modification des mêmes propriétés de l'autre colonne. Je suppose que cela vient du Shared. Mais comme j'avoue avoir du mal avec ces choses là, je n'en suis pas sûr. Toujours est-il que si je ne mets pas "Shared" alors ça ne marche plus du tout, le DirectCast ne semble pas transmettre correctement les valeurs à la classe DataGridViewStarRateCell.

    Quelqu'un a-t-il une piste ?

  9. #9
    Modérateur

    Homme Profil pro
    Inscrit en
    Janvier 2007
    Messages
    1 722
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Janvier 2007
    Messages : 1 722
    Points : 5 100
    Points
    5 100
    Par défaut
    Citation Envoyé par rv26t Voir le message
    il doit aussi falloir un attribut pour marquer la sérialisation.
    Des attributs de sérialisation pour les classes, du genre
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    <Serializable()>
    Public Class DataGridViewStarRateColumn
    '...
     
    <Serializable()>
    Public Class DataGridViewStarRateCell
    '...
    J'avais vu cela pour un userControl avec une ListeBox qui contenait les choix d'une classe. La classe devait être défini avec cet attribut pour que les saisies soit conservées par le designer.
    Mais difficile de trouver de l'info et des pistes sur ce sujet.

    Sinon (dans notre cas Private Shared _starwidth As Integer = 20) shared permet en fait de créer une variable unique en mémoire utilisée par toutes les instances créées de la classe (et cette variable existe et est accessible (NomClasse.NomVariable) même si aucune instance n'est créée.)
    Traductions d'articles :
    La mémoire en .NET - Qu'est-ce qui va où ?
    Architecture DAL de haute performance et DTO ; Version C# : Partie 1,Partie 2,Partie 3 — Version VB.NET : Partie 1,Partie 2,Partie 3
    N'hésitez pas à consulter la FAQ VB.NET, le cours complet de Philippe Lasserre et tous les cours, articles et tutoriels.

  10. #10
    Membre actif
    Inscrit en
    Juillet 2013
    Messages
    772
    Détails du profil
    Informations forums :
    Inscription : Juillet 2013
    Messages : 772
    Points : 275
    Points
    275
    Par défaut
    Depuis mon message précédent, je m'arrache les cheveux avec cette histoire de transmission de données d'une classe à l'autre.
    Ta méthode DirectCast... ne marche pas en fait si la propriété est privée. Et elle doit l'être ; j'ai en effet pigé les différences entre shared, private, friend et public.
    En fait le paramètre est réinitialisé par la 2ème classe. C'est difficile à débuger car le cheminement du code, même en le suivant pas à pas, n'est pas très clair pour moi.
    J'ai ressayé d'instancier la 2ème classe avec un paramètre dans la sub new comme j'avais évoqué plus haut, et je ne comprends toujours pas pourquoi ça ne marche pas. Ca me semblait tellement logique et dans la lignée de ce que je lis dans les tutos... L'erreur apparaît à un moment : "aucun constructeur sans paramètre défini pour cet objet VB.NET"
    J'ai même trouvé un autre topic avec le même pb sans qu'une solution n'ait été trouvée : http://www.developpez.net/forums/d26...-constructeur/.

    Pour l'instant je me concentre sur ce pb. Le non effacement des données dans le designer.vb peut attendre.

  11. #11
    Modérateur

    Homme Profil pro
    Inscrit en
    Janvier 2007
    Messages
    1 722
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Janvier 2007
    Messages : 1 722
    Points : 5 100
    Points
    5 100
    Par défaut
    Citation Envoyé par noftal Voir le message
    Ta méthode DirectCast... ne marche pas en fait si la propriété est privée. Et elle doit l'être ; j'ai en effet pigé les différences entre shared, private, friend et public.
    En fait le paramètre est réinitialisé par la 2ème classe. C'est difficile à débuger car le cheminement du code, même en le suivant pas à pas, n'est pas très clair pour moi.
    la variable _starheight doit être privée.
    La propriété starheight doit être publique.

    La sérialisation ne fonctionnera que sur la propriété publique. [Edit]Enfin ça, c'est pour une sérialisation classique en xml, du coup je ne sais pas si ça s'applique au designer. ???[/Edit]
    Il existe l'attribut <System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Visible)> (ou .Content), mais il me laisse perplexe quand à son utilisation.

    Citation Envoyé par noftal Voir le message
    J'ai ressayé d'instancier la 2ème classe avec un paramètre dans la sub new comme j'avais évoqué plus haut, et je ne comprends toujours pas pourquoi ça ne marche pas. Ca me semblait tellement logique et dans la lignée de ce que je lis dans les tutos... L'erreur apparaît à un moment : "aucun constructeur sans paramètre défini pour cet objet VB.NET"
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    <Serializable()>
    Public Class DataGridViewStarRateColumn
        Inherits DataGridViewTextBoxColumn
     
        Public Sub New()
            Me.CellTemplate = New DataGridViewStarRateCell(_starheight)
        End Sub
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    <Serializable()>
    Public Class DataGridViewStarRateCell
        Inherits DataGridViewTextBoxCell
     
        Public Sub New()
        End Sub
     
        Public Sub New(hauteur As Integer)
            MyBase.New()
            _starheight = hauteur
        End Sub
    Traductions d'articles :
    La mémoire en .NET - Qu'est-ce qui va où ?
    Architecture DAL de haute performance et DTO ; Version C# : Partie 1,Partie 2,Partie 3 — Version VB.NET : Partie 1,Partie 2,Partie 3
    N'hésitez pas à consulter la FAQ VB.NET, le cours complet de Philippe Lasserre et tous les cours, articles et tutoriels.

  12. #12
    Membre actif
    Inscrit en
    Juillet 2013
    Messages
    772
    Détails du profil
    Informations forums :
    Inscription : Juillet 2013
    Messages : 772
    Points : 275
    Points
    275
    Par défaut
    C'est ce que j'avais fait hormis le Serializable() que je viens de rajouter mais ça n'empêche pas l'erreur évoquée plus haut.
    Pour déboguer plus facilement, j'ai simplifié le code en ne gardant qu'une propriété (StarWidth) et en "figeant" les 2 autres. J'ai gardé la méthode paint complète qui est donc un peu longue, mais elle n'a pas d'importance dans le déboguage
    Cela donne le code suivant.

    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
    Imports System.Drawing
    Imports System.Windows.Forms
    Imports System.Windows.Forms.VisualStyles
    Imports System.ComponentModel
     
     
    <Serializable()>
    Public Class DataGridViewStarRateColumn
        Inherits DataGridViewTextBoxColumn
     
        Private _starwidth As Integer = 20
        Private oDTGstarCell As DataGridViewStarRateCell
     
        Public Sub New()
            oDTGstarCell = New DataGridViewStarRateCell(_starwidth)
            Me.CellTemplate = oDTGstarCell
            'oDTGstarCell.cStarWidth = _starwidth
     
        End Sub
     
        <Category("Design")>
     <Description("Largeur de l'étoile")>
        Public Property StarWidth() As Integer
            Get
                Return _starwidth
            End Get
            Set(ByVal value As Integer)
                _starwidth = value
                oDTGstarCell.cStarWidth = _starwidth
            End Set
        End Property
    End Class
     
    <Serializable()>
    Public Class DataGridViewStarRateCell
        Inherits DataGridViewTextBoxCell
     
        Private _celstarwidth As Integer
        Private _starheight As Integer = 20
        Private _staralignment As DataGridViewContentAlignment = DataGridViewContentAlignment.BottomLeft
     
        <Category("Design")>
       <Description("Largeur de l'étoile")>
        Public Property cStarWidth() As Integer
            Get
                Return _celstarwidth
            End Get
            Set(ByVal value As Integer)
                _celstarwidth = value
            End Set
        End Property
     
     
     
        ' Override the Clone method so that the Enabled property is copied. 
        Public Overrides Function Clone() As Object
            Dim Cell As DataGridViewStarRateCell = _
                CType(MyBase.Clone(), DataGridViewStarRateCell)
            Return Cell
        End Function
     
        Public Sub New(largeur As Integer)
            MyBase.New()
            _celstarwidth = largeur
        End Sub
     
     
        Protected Overrides Sub Paint(ByVal graphics As Graphics, _
            ByVal clipBounds As Rectangle, ByVal cellBounds As Rectangle, _
            ByVal rowIndex As Integer, _
            ByVal elementState As DataGridViewElementStates, _
            ByVal value As Object, ByVal formattedValue As Object, _
            ByVal errorText As String, _
            ByVal cellStyle As DataGridViewCellStyle, _
            ByVal advancedBorderStyle As DataGridViewAdvancedBorderStyle, _
            ByVal paintParts As DataGridViewPaintParts)
     
            If _celstarwidth <> 0 Then
                MyBase.Paint(graphics, clipBounds, cellBounds, rowIndex, elementState, Nothing, Nothing, errorText, cellStyle, advancedBorderStyle, paintParts)
     
                'Set the scaling mode to high quality (makes the stars look good at any size)
                graphics.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
     
                ' dessine le nombre d'étoiles correspondant à la valeur de la cellule
                ' le dessin est limité aux dimensions de la cellule
                Dim starValue As Integer 'valeur de la note
                Dim filledtouse As Image = My.Resources.star_xxl 'une étoile
                Dim height As Integer = filledtouse.Height
                Dim width As Integer = filledtouse.Width
                Dim destRectX, destRectY, destRectWidth, destRectHeight As Integer
                Dim srcRectWidth, srcRectHeight As Integer
                Dim destRect, srcRect As Rectangle
                starValue = value
                Dim toto% = Me.cStarWidth
                ' réglage alignement des étoiles dans la cellule
                Dim offsetX, offsetY As Integer
                Select Case _staralignment
                    Case DataGridViewContentAlignment.BottomCenter
                        offsetX = Math.Max(0, (cellBounds.Width - starValue * _celstarwidth) / 2) ' Center
                        offsetY = Math.Max(0, (cellBounds.Height - _starheight)) 'Bottom
                    Case DataGridViewContentAlignment.BottomLeft
                        offsetX = 0 'left
                        offsetY = Math.Max(0, (cellBounds.Height - _starheight)) 'Bottom
                    Case DataGridViewContentAlignment.BottomRight
                        offsetX = Math.Max(0, cellBounds.Width - starValue * _celstarwidth) 'Right
                        offsetY = Math.Max(0, (cellBounds.Height - _starheight)) 'Bottom
                    Case DataGridViewContentAlignment.MiddleCenter
                        offsetX = Math.Max(0, (cellBounds.Width - starValue * _celstarwidth) / 2) ' Center
                        offsetY = Math.Max(0, (cellBounds.Height - _starheight) / 2) ' Middle
                    Case DataGridViewContentAlignment.MiddleLeft
                        offsetX = 0 'left
                        offsetY = Math.Max(0, (cellBounds.Height - _starheight) / 2) ' Middle
                    Case DataGridViewContentAlignment.MiddleRight
                        offsetX = Math.Max(0, cellBounds.Width - starValue * _celstarwidth) 'Right
                        offsetY = Math.Max(0, (cellBounds.Height - _starheight) / 2) ' Middle
                    Case DataGridViewContentAlignment.TopCenter
                        offsetX = Math.Max(0, (cellBounds.Width - starValue * _celstarwidth) / 2) ' Center
                        offsetY = 0 'top
                    Case DataGridViewContentAlignment.TopLeft, DataGridViewContentAlignment.NotSet
                        offsetX = 0 'left
                        offsetY = 0 'top
                    Case DataGridViewContentAlignment.TopRight
                        offsetX = Math.Max(0, cellBounds.Width - starValue * _celstarwidth) 'Right
                End Select
     
                For i = 1 To starValue
                    destRectX = cellBounds.X + offsetX + (i - 1) * _celstarwidth
                    destRectY = cellBounds.Y + offsetY
                    destRectWidth = Math.Min(_celstarwidth, cellBounds.Width - (i - 1) * _celstarwidth) - 1
                    destRectHeight = Math.Min(cellBounds.Height, _starheight) - 1
                    srcRectWidth = width / _celstarwidth * destRectWidth
                    srcRectHeight = height * Math.Min(cellBounds.Height / _starheight, 1)
                    destRect = New Rectangle(destRectX, destRectY, destRectWidth, destRectHeight)
                    srcRect = New Rectangle(0, 0, srcRectWidth, srcRectHeight)
                    graphics.DrawImage(filledtouse, destRect, srcRect, GraphicsUnit.Pixel)
                Next
     
            End If
        End Sub
     
    End Class

  13. #13
    Modérateur

    Homme Profil pro
    Inscrit en
    Janvier 2007
    Messages
    1 722
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Janvier 2007
    Messages : 1 722
    Points : 5 100
    Points
    5 100
    Par défaut
    Tu n'as pas
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
        Public Sub New()
        End Sub
    dans la classe DataGridViewStarRateCell
    regarde mes débuts de classes sur le post au-dessus

    Le Serializable est normalement pour conserver les saisies dans le designer.
    [Edit]Et l'attribut <System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)> sur StarWidth pour préciser à la propriété de sauvegarder son contenu.[/Edit]
    Traductions d'articles :
    La mémoire en .NET - Qu'est-ce qui va où ?
    Architecture DAL de haute performance et DTO ; Version C# : Partie 1,Partie 2,Partie 3 — Version VB.NET : Partie 1,Partie 2,Partie 3
    N'hésitez pas à consulter la FAQ VB.NET, le cours complet de Philippe Lasserre et tous les cours, articles et tutoriels.

  14. #14
    Membre actif
    Inscrit en
    Juillet 2013
    Messages
    772
    Détails du profil
    Informations forums :
    Inscription : Juillet 2013
    Messages : 772
    Points : 275
    Points
    275
    Par défaut
    OK, j'ai corrigé.
    Ca ne plante plus mais la valeur _celstarwidth reste désespérément égale à 0 ce qui provoque une erreur dans le code ci-dessous en ligne 137 (division par zero). Tout se passe comme si la ligne 66 n'était pas prise en compte.

    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
    Imports System.Drawing
    Imports System.Windows.Forms
    Imports System.Windows.Forms.VisualStyles
    Imports System.ComponentModel
     
     
    <Serializable()>
    Public Class DataGridViewStarRateColumn
        Inherits DataGridViewTextBoxColumn
     
        Private _starwidth As Integer = 20
        Private oDTGstarCell As DataGridViewStarRateCell
     
        Public Sub New()
            oDTGstarCell = New DataGridViewStarRateCell(_starwidth)
            Me.CellTemplate = oDTGstarCell
            'oDTGstarCell.cStarWidth = _starwidth
     
        End Sub
     
        <Category("Design")>
     <Description("Largeur de l'étoile")>
     <System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)>
        Public Property StarWidth() As Integer
            Get
                Return _starwidth
            End Get
            Set(ByVal value As Integer)
                _starwidth = value
                oDTGstarCell.cStarWidth = _starwidth
            End Set
        End Property
    End Class
     
    <Serializable()>
    Public Class DataGridViewStarRateCell
        Inherits DataGridViewTextBoxCell
     
        Private _celstarwidth As Integer
        Private _starheight As Integer = 20
        Private _staralignment As DataGridViewContentAlignment = DataGridViewContentAlignment.BottomLeft
     
        <Category("Design")>
       <Description("Largeur de l'étoile")>
        <System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)>
        Public Property cStarWidth() As Integer
            Get
                Return _celstarwidth
            End Get
            Set(ByVal value As Integer)
                _celstarwidth = value
            End Set
        End Property
     
     
     
        ' Override the Clone method so that the Enabled property is copied. 
        Public Overrides Function Clone() As Object
            Dim Cell As DataGridViewStarRateCell = _
                CType(MyBase.Clone(), DataGridViewStarRateCell)
            Return Cell
        End Function
     
        Public Sub New(largeur As Integer)
            MyBase.New()
            _celstarwidth = largeur
        End Sub
     
        Public Sub New()
     
        End Sub
     
     
        Protected Overrides Sub Paint(ByVal graphics As Graphics, _
            ByVal clipBounds As Rectangle, ByVal cellBounds As Rectangle, _
            ByVal rowIndex As Integer, _
            ByVal elementState As DataGridViewElementStates, _
            ByVal value As Object, ByVal formattedValue As Object, _
            ByVal errorText As String, _
            ByVal cellStyle As DataGridViewCellStyle, _
            ByVal advancedBorderStyle As DataGridViewAdvancedBorderStyle, _
            ByVal paintParts As DataGridViewPaintParts)
     
            'If _celstarwidth <> 0 Then
            MyBase.Paint(graphics, clipBounds, cellBounds, rowIndex, elementState, Nothing, Nothing, errorText, cellStyle, advancedBorderStyle, paintParts)
     
            'Set the scaling mode to high quality (makes the stars look good at any size)
            graphics.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
     
            ' dessine le nombre d'étoiles correspondant à la valeur de la cellule
            ' le dessin est limité aux dimensions de la cellule
            Dim starValue As Integer 'valeur de la note
            Dim filledtouse As Image = My.Resources.star_xxl 'une étoile
            Dim height As Integer = filledtouse.Height
            Dim width As Integer = filledtouse.Width
            Dim destRectX, destRectY, destRectWidth, destRectHeight As Integer
            Dim srcRectWidth, srcRectHeight As Integer
            Dim destRect, srcRect As Rectangle
            starValue = value
            Dim toto% = Me.cStarWidth
            ' réglage alignement des étoiles dans la cellule
            Dim offsetX, offsetY As Integer
            Select Case _staralignment
                Case DataGridViewContentAlignment.BottomCenter
                    offsetX = Math.Max(0, (cellBounds.Width - starValue * _celstarwidth) / 2) ' Center
                    offsetY = Math.Max(0, (cellBounds.Height - _starheight)) 'Bottom
                Case DataGridViewContentAlignment.BottomLeft
                    offsetX = 0 'left
                    offsetY = Math.Max(0, (cellBounds.Height - _starheight)) 'Bottom
                Case DataGridViewContentAlignment.BottomRight
                    offsetX = Math.Max(0, cellBounds.Width - starValue * _celstarwidth) 'Right
                    offsetY = Math.Max(0, (cellBounds.Height - _starheight)) 'Bottom
                Case DataGridViewContentAlignment.MiddleCenter
                    offsetX = Math.Max(0, (cellBounds.Width - starValue * _celstarwidth) / 2) ' Center
                    offsetY = Math.Max(0, (cellBounds.Height - _starheight) / 2) ' Middle
                Case DataGridViewContentAlignment.MiddleLeft
                    offsetX = 0 'left
                    offsetY = Math.Max(0, (cellBounds.Height - _starheight) / 2) ' Middle
                Case DataGridViewContentAlignment.MiddleRight
                    offsetX = Math.Max(0, cellBounds.Width - starValue * _celstarwidth) 'Right
                    offsetY = Math.Max(0, (cellBounds.Height - _starheight) / 2) ' Middle
                Case DataGridViewContentAlignment.TopCenter
                    offsetX = Math.Max(0, (cellBounds.Width - starValue * _celstarwidth) / 2) ' Center
                    offsetY = 0 'top
                Case DataGridViewContentAlignment.TopLeft, DataGridViewContentAlignment.NotSet
                    offsetX = 0 'left
                    offsetY = 0 'top
                Case DataGridViewContentAlignment.TopRight
                    offsetX = Math.Max(0, cellBounds.Width - starValue * _celstarwidth) 'Right
            End Select
     
            For i = 1 To starValue
                destRectX = cellBounds.X + offsetX + (i - 1) * _celstarwidth
                destRectY = cellBounds.Y + offsetY
                destRectWidth = Math.Min(_celstarwidth, cellBounds.Width - (i - 1) * _celstarwidth) - 1
                destRectHeight = Math.Min(cellBounds.Height, _starheight) - 1
                srcRectWidth = width / _celstarwidth * destRectWidth
                srcRectHeight = height * Math.Min(cellBounds.Height / _starheight, 1)
                destRect = New Rectangle(destRectX, destRectY, destRectWidth, destRectHeight)
                srcRect = New Rectangle(0, 0, srcRectWidth, srcRectHeight)
                graphics.DrawImage(filledtouse, destRect, srcRect, GraphicsUnit.Pixel)
            Next
     
            'End If
        End Sub
     
    End Class

  15. #15
    Modérateur

    Homme Profil pro
    Inscrit en
    Janvier 2007
    Messages
    1 722
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Janvier 2007
    Messages : 1 722
    Points : 5 100
    Points
    5 100
    Par défaut
    Ta fonction clone doit traiter et mettre à jour les nouvelles variables de la classe.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
        Public Overrides Function Clone() As Object
            Dim Cell As DataGridViewStarRateCell = CType(MyBase.Clone(), DataGridViewStarRateCell)
            Cell.StarHeight = _starheight
            Cell.StarWidth = _starwidth
            Return Cell
        End Function
    Reste le problème sur le designer (qui ne garde pas les modif.)
    Traductions d'articles :
    La mémoire en .NET - Qu'est-ce qui va où ?
    Architecture DAL de haute performance et DTO ; Version C# : Partie 1,Partie 2,Partie 3 — Version VB.NET : Partie 1,Partie 2,Partie 3
    N'hésitez pas à consulter la FAQ VB.NET, le cours complet de Philippe Lasserre et tous les cours, articles et tutoriels.

  16. #16
    Membre actif
    Inscrit en
    Juillet 2013
    Messages
    772
    Détails du profil
    Informations forums :
    Inscription : Juillet 2013
    Messages : 772
    Points : 275
    Points
    275
    Par défaut
    Effectivement, ça marche ainsi.
    Est-ce que tu peux m'expliquer ce que fait cette fonction Clone et pourquoi elle est nécessaire parce que je n'ai toujours pas compris ? Je n'ai fait que la "recopier" parce que j'avais lu qu'il la fallait.
    Sinon, il reste effectivement la mémorisation de StarWidth dans la designer. Dès que je change de colonne dans le designer, la valeur disparaît.
    Ce qui m'étonne c'est que
    - avec shared, c'était bien mémorisé.
    - je n'ai pas ce pb de mémorisation avec mes autres usercontrols. Le fait de déclarer une variable privée _starwidth et de définir une propriété similaire suffit.

  17. #17
    Modérateur

    Homme Profil pro
    Inscrit en
    Janvier 2007
    Messages
    1 722
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Janvier 2007
    Messages : 1 722
    Points : 5 100
    Points
    5 100
    Par défaut
    Citation Envoyé par noftal Voir le message
    Est-ce que tu peux m'expliquer ce que fait cette fonction Clone et pourquoi elle est nécessaire parce que je n'ai toujours pas compris ? Je n'ai fait que la "recopier" parce que j'avais lu qu'il la fallait.
    Je vais essayer, mais je ne connais pas suffisement tout le fonctionnement interne du contrôle datagridview.
    Elle sert ainsi, pour créer une copie.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
            Dim newCol As DataGridViewColumn
            newCol = DirectCast(DGVEtoile.Columns("Etoile").Clone(), DataGridViewColumn)
            DataGridView1.Columns.Add(newCol)
    msdn :
    Lorsque vous effectuez une dérivation à partir de DataGridViewCell ou DataGridViewColumn et ajoutez de nouvelles propriétés à la classe dérivée, veillez à substituer la méthode Clone pour copier les nouvelles propriétés au cours des opérations de clonage.Vous devez également appeler la méthode Clone de la classe de base afin que les propriétés de cette classe soient copiées dans la nouvelle cellule ou colonne.
    J'en déduit que lorsque l'on clone une colonne, il part du schéma (template) de la colonne et fait une copie (ce qui semble logique).
    Apparement elle sert aussi lors du new (pour créer la colonne).
    Autre utilité (ex:designer) ?

    Remarques à l'attention des héritiers
    Lors de la substitution de Clone dans une classe dérivée, appelez la méthode Clone de la classe de base de manière à ce que les propriétés de cette classe soient copiées dans la nouvelle bande et veillez à également copier les valeurs de toute propriété qui aura été ajoutée à la classe dérivée.
    La méthode clone fait une copie, mais ne garde pas les valeurs, il faut les affecter de nouveau au nouvelles propriétés.
    Je dirai que cela reste tout de même a vérifier ou/et à approfondir.

    Je pressents que c'est là que notre problème de sauvegarde de la valeur dans le designer, (après je peut me tromper) mais je ne connais pas tout le fonctionnement interne, donc difficile de voir la solution pour indiquer au designer de notifier les valeurs.
    (j'ai cherché partout sur le net, mais rien de concluant, poutant il doit y avoir un moyen)
    Normalement, c'est les attributs qui définissent la persistance de ces valeurs.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    <Serializable()>
    Public Class DataGridViewStarRateCell
        Inherits DataGridViewTextBoxCell
    Permet de rendre persistant la classe.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
       <System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content And System.ComponentModel.DesignerSerializationVisibility.Visible)>
        Public Property StarWidth() As Integer
    Et normalement .content indique de rendre la valeur de la propriété persistant.

    Citation Envoyé par noftal Voir le message
    - avec shared, c'était bien mémorisé.
    - je n'ai pas ce pb de mémorisation avec mes autres usercontrols. Le fait de déclarer une variable privée _starwidth et de définir une propriété similaire suffit.
    Avec Shared c'est différent, tu crés une zone mémoire (unique), et toutes les instances (ou l'accés direct par la classe) vont chercher la valeur à cet endroit. Une fois créée, elle est forcement accessible qu'elle que soit la façon dont tu géres tes objets (et quelques soit le nombre d'objets).

    Citation Envoyé par noftal Voir le message
    - je n'ai pas ce pb de mémorisation avec mes autres usercontrols. Le fait de déclarer une variable privée _starwidth et de définir une propriété similaire suffit.
    Je suis bien d'accord avec toi, un user control avec un combobox et une liste d'une classe sous-jacente permet de remplir la combo dans le designer avec les valeurs de la liste juste en plassant l'attribut <Serializable()> sur la classe, et tout est concervé.

    J'espère que cela t'aide à avancer.
    Là, je suis un peu perplexe, mais j'aimerai bien trouver la solution. (il faudrait trouver le fonctionnement de création de colonne, cela nous donnerait des pistes.) Je continu de chercher.
    Espérons qu'un membre plus éclairé passe par là.

    [Edit]La méthode clone : je viens de voir qu'elle est utilisé aussi pour le designer. voir paragraphe 7 DataGridView Watermark Cell[/Edit]
    Traductions d'articles :
    La mémoire en .NET - Qu'est-ce qui va où ?
    Architecture DAL de haute performance et DTO ; Version C# : Partie 1,Partie 2,Partie 3 — Version VB.NET : Partie 1,Partie 2,Partie 3
    N'hésitez pas à consulter la FAQ VB.NET, le cours complet de Philippe Lasserre et tous les cours, articles et tutoriels.

  18. #18
    Membre actif
    Inscrit en
    Juillet 2013
    Messages
    772
    Détails du profil
    Informations forums :
    Inscription : Juillet 2013
    Messages : 772
    Points : 275
    Points
    275
    Par défaut
    Citation Envoyé par rv26t Voir le message
    [Edit]La méthode clone : je viens de voir qu'elle est utilisé aussi pour le designer. voir paragraphe 7 DataGridView Watermark Cell[/Edit]
    C'est de la bombe, ce lien !

    Grâce à lui, j'ai réussi à faire fonctionner le bignou.
    C'est plutôt plus simple que précédemment.

    Je me hâte de partager le code en supprimant tout ce qui n'est plus utile (notamment les attributs)

    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
    Imports System.Drawing
    Imports System.Windows.Forms
    Imports System.Windows.Forms.VisualStyles
    Imports System.ComponentModel
     
     
    Public Class DataGridViewStarRateColumn
        Inherits DataGridViewTextBoxColumn
     
        Public Sub New()
            Me.CellTemplate = New DataGridViewStarRateCell()
     
        End Sub
     
        <Category("Design")>
     <Description("Largeur de l'étoile")>
        Public Property StarWidth() As Integer
            Get
                If DirectCast(CellTemplate, DataGridViewStarRateCell) Is Nothing Then
                    Throw New InvalidOperationException("cell template required")
                End If
                Return DirectCast(CellTemplate, DataGridViewStarRateCell).StarWidth
     
            End Get
            Set(ByVal value As Integer)
                If Me.StarWidth <> value Then
                    DirectCast(CellTemplate, DataGridViewStarRateCell).StarWidth = value
                    If Me.DataGridView IsNot Nothing Then
                        Dim dataGridViewRows As DataGridViewRowCollection = Me.DataGridView.Rows
                        Dim rowCount As Integer = dataGridViewRows.Count
                        For rowIndex As Integer = 0 To rowCount - 1
                            Dim dataGridViewRow As DataGridViewRow = dataGridViewRows.SharedRow(rowIndex)
                            Dim cell As DataGridViewStarRateCell = TryCast(dataGridViewRow.Cells(Me.Index), DataGridViewStarRateCell)
                            If cell IsNot Nothing Then
                                cell.StarWidth = value
                            End If
                        Next
                    End If
                End If
            End Set
        End Property
     
     
    End Class
     
     
     
    Public Class DataGridViewStarRateCell
        Inherits DataGridViewTextBoxCell
     
        Private _starwidth As Integer = 20
        Private _starheight As Integer = 20
        Private _staralignment As DataGridViewContentAlignment = DataGridViewContentAlignment.TopLeft
     
        <Category("Design")>
       <Description("Largeur de l'étoile")>
        Public Property StarWidth() As Integer
            Get
                Return _starwidth
            End Get
            Set(ByVal value As Integer)
                _starwidth = value
            End Set
        End Property
     
     
     
        ' Override the Clone method so that the Enabled property is copied. 
        Public Overrides Function Clone() As Object
            Dim Cell As DataGridViewStarRateCell = DirectCast(MyBase.Clone(), DataGridViewStarRateCell)
            Cell.StarWidth = Me.StarWidth
            Return Cell
        End Function
     
     
        Protected Overrides Sub Paint(ByVal graphics As Graphics, _
            ByVal clipBounds As Rectangle, ByVal cellBounds As Rectangle, _
            ByVal rowIndex As Integer, _
            ByVal elementState As DataGridViewElementStates, _
            ByVal value As Object, ByVal formattedValue As Object, _
            ByVal errorText As String, _
            ByVal cellStyle As DataGridViewCellStyle, _
            ByVal advancedBorderStyle As DataGridViewAdvancedBorderStyle, _
            ByVal paintParts As DataGridViewPaintParts)
     
            MyBase.Paint(graphics, clipBounds, cellBounds, rowIndex, elementState, Nothing, Nothing, errorText, cellStyle, advancedBorderStyle, paintParts)
     
            'Set the scaling mode to high quality (makes the stars look good at any size)
            graphics.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
     
            ' dessine le nombre d'étoiles correspondant à la valeur de la cellule
            ' le dessin est limité aux dimensions de la cellule
            Dim starValue As Integer 'valeur de la note
            Dim filledtouse As Image = My.Resources.star_xxl 'une étoile
            Dim height As Integer = filledtouse.Height
            Dim width As Integer = filledtouse.Width
            Dim destRectX, destRectY, destRectWidth, destRectHeight As Integer
            Dim srcRectWidth, srcRectHeight As Integer
            Dim destRect, srcRect As Rectangle
            starValue = value
            ' réglage alignement des étoiles dans la cellule
            Dim offsetX, offsetY As Integer
            Select Case _staralignment
                Case DataGridViewContentAlignment.BottomCenter
                    offsetX = Math.Max(0, (cellBounds.Width - starValue * _starwidth) / 2) ' Center
                    offsetY = Math.Max(0, (cellBounds.Height - _starheight)) 'Bottom
                Case DataGridViewContentAlignment.BottomLeft
                    offsetX = 0 'left
                    offsetY = Math.Max(0, (cellBounds.Height - _starheight)) 'Bottom
                Case DataGridViewContentAlignment.BottomRight
                    offsetX = Math.Max(0, cellBounds.Width - starValue * _starwidth) 'Right
                    offsetY = Math.Max(0, (cellBounds.Height - _starheight)) 'Bottom
                Case DataGridViewContentAlignment.MiddleCenter
                    offsetX = Math.Max(0, (cellBounds.Width - starValue * _starwidth) / 2) ' Center
                    offsetY = Math.Max(0, (cellBounds.Height - _starheight) / 2) ' Middle
                Case DataGridViewContentAlignment.MiddleLeft
                    offsetX = 0 'left
                    offsetY = Math.Max(0, (cellBounds.Height - _starheight) / 2) ' Middle
                Case DataGridViewContentAlignment.MiddleRight
                    offsetX = Math.Max(0, cellBounds.Width - starValue * _starwidth) 'Right
                    offsetY = Math.Max(0, (cellBounds.Height - _starheight) / 2) ' Middle
                Case DataGridViewContentAlignment.TopCenter
                    offsetX = Math.Max(0, (cellBounds.Width - starValue * _starwidth) / 2) ' Center
                    offsetY = 0 'top
                Case DataGridViewContentAlignment.TopLeft, DataGridViewContentAlignment.NotSet
                    offsetX = 0 'left
                    offsetY = 0 'top
                Case DataGridViewContentAlignment.TopRight
                    offsetX = Math.Max(0, cellBounds.Width - starValue * _starwidth) 'Right
            End Select
     
            For i = 1 To starValue
                destRectX = cellBounds.X + offsetX + (i - 1) * _starwidth
                destRectY = cellBounds.Y + offsetY
                destRectWidth = Math.Min(_starwidth, cellBounds.Width - (i - 1) * _starwidth) - 1
                destRectHeight = Math.Min(cellBounds.Height, _starheight) - 1
                srcRectWidth = width / _starwidth * destRectWidth
                srcRectHeight = height * Math.Min(cellBounds.Height / _starheight, 1)
                destRect = New Rectangle(destRectX, destRectY, destRectWidth, destRectHeight)
                srcRect = New Rectangle(0, 0, srcRectWidth, srcRectHeight)
                graphics.DrawImage(filledtouse, destRect, srcRect, GraphicsUnit.Pixel)
            Next
     
        End Sub
     
    End Class
    Il me reste plus qu'à généraliser avec les autres propriétés StarHeight et StarAlignment, et c'est tout bon. Je vais quand même aller au bout cette fois avant de clore le sujet au cas où...

  19. #19
    Membre actif
    Inscrit en
    Juillet 2013
    Messages
    772
    Détails du profil
    Informations forums :
    Inscription : Juillet 2013
    Messages : 772
    Points : 275
    Points
    275
    Par défaut
    Bon cette fois, je crois que je tiens le bon bout.

    Ce que je comprends :
    - Les propriétés apparaissant dans le designer sont celles de la classe DataGridViewStarRateColumn
    - La propriété clone était correctement codée, c'est la façon de gérer les propriétés qui semble avoir posé pb dans la mémorisation des propriétés dans le designer: voir les 2 points suivants
    - Le Get de la propriété StarWidth de DataGridViewStarRateColumn va chercher sa valeur dans la propriété équivalente de DataGridViewStarRateCell (et non le contraire)
    - Le Set de la propriété StarWidth de DataGridViewStarRateColumn met à jour la propriété équivalente de DataGridViewStarRateCell pour toutes les cellules de la colonne

    Franchement, je n'aurais pas trouvé tout seul.
    Une grand merci à rv26t pour sa précieuse aide.

    Voici le code complet la classe, avec toutes ses propriétés.

    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
    209
    210
    211
    212
    213
    214
    215
    216
    217
    Imports System.Drawing
    Imports System.Windows.Forms
    Imports System.Windows.Forms.VisualStyles
    Imports System.ComponentModel
     
     
    Public Class DataGridViewStarRateColumn
        Inherits DataGridViewTextBoxColumn
     
        Public Sub New()
            Me.CellTemplate = New DataGridViewStarRateCell()
     
        End Sub
     
        <Category("Design")>
     <Description("Largeur de l'étoile")>
        Public Property StarWidth() As Integer
            Get
                If DirectCast(CellTemplate, DataGridViewStarRateCell) Is Nothing Then
                    Throw New InvalidOperationException("cell template required")
                End If
                Return DirectCast(CellTemplate, DataGridViewStarRateCell).StarWidth
            End Get
     
            Set(ByVal value As Integer)
                If Me.StarWidth <> value Then
                    DirectCast(CellTemplate, DataGridViewStarRateCell).StarWidth = value
                    If Me.DataGridView IsNot Nothing Then
                        Dim dataGridViewRows As DataGridViewRowCollection = Me.DataGridView.Rows
                        Dim rowCount As Integer = dataGridViewRows.Count
                        For rowIndex As Integer = 0 To rowCount - 1
                            Dim dataGridViewRow As DataGridViewRow = dataGridViewRows.SharedRow(rowIndex)
                            Dim cell As DataGridViewStarRateCell = TryCast(dataGridViewRow.Cells(Me.Index), DataGridViewStarRateCell)
                            If cell IsNot Nothing Then
                                cell.StarWidth = value
                            End If
                        Next
                    End If
                End If
            End Set
        End Property
     
        <Category("Design")>
    <Description("Hauteur de l'étoile")>
        Public Property StarHeight() As Integer
            Get
                If DirectCast(CellTemplate, DataGridViewStarRateCell) Is Nothing Then
                    Throw New InvalidOperationException("cell template required")
                End If
                Return DirectCast(CellTemplate, DataGridViewStarRateCell).StarHeight
            End Get
            Set(value As Integer)
                If Me.StarHeight <> value Then
                    DirectCast(CellTemplate, DataGridViewStarRateCell).StarHeight = value
                    If Me.DataGridView IsNot Nothing Then
                        Dim dataGridViewRows As DataGridViewRowCollection = Me.DataGridView.Rows
                        Dim rowCount As Integer = dataGridViewRows.Count
                        For rowIndex As Integer = 0 To rowCount - 1
                            Dim dataGridViewRow As DataGridViewRow = dataGridViewRows.SharedRow(rowIndex)
                            Dim cell As DataGridViewStarRateCell = TryCast(dataGridViewRow.Cells(Me.Index), DataGridViewStarRateCell)
                            If cell IsNot Nothing Then
                                cell.StarHeight = value
                            End If
                        Next
                    End If
                End If
            End Set
        End Property
     
     
        <Category("Design")>
    <Description("Alignement des étoiles dans la cellule")>
        Public Property StarAlignment() As DataGridViewContentAlignment
            Get
                If DirectCast(CellTemplate, DataGridViewStarRateCell) Is Nothing Then
                    Throw New InvalidOperationException("cell template required")
                End If
                Return DirectCast(CellTemplate, DataGridViewStarRateCell).StarAlignment
            End Get
            Set(value As DataGridViewContentAlignment)
                If Me.StarAlignment <> value Then
                    DirectCast(CellTemplate, DataGridViewStarRateCell).StarAlignment = value
                    If Me.DataGridView IsNot Nothing Then
                        Dim dataGridViewRows As DataGridViewRowCollection = Me.DataGridView.Rows
                        Dim rowCount As Integer = dataGridViewRows.Count
                        For rowIndex As Integer = 0 To rowCount - 1
                            Dim dataGridViewRow As DataGridViewRow = dataGridViewRows.SharedRow(rowIndex)
                            Dim cell As DataGridViewStarRateCell = TryCast(dataGridViewRow.Cells(Me.Index), DataGridViewStarRateCell)
                            If cell IsNot Nothing Then
                                cell.StarAlignment = value
                            End If
                        Next
                    End If
                End If
            End Set
        End Property
    End Class
     
     
     
    Public Class DataGridViewStarRateCell
        Inherits DataGridViewTextBoxCell
     
        Private _starwidth As Integer = 20
        Private _starheight As Integer = 20
        Private _staralignment As DataGridViewContentAlignment = DataGridViewContentAlignment.TopLeft
     
     
        Public Property StarWidth() As Integer
            Get
                Return _starwidth
            End Get
            Set(ByVal value As Integer)
                _starwidth = value
            End Set
        End Property
     
     
        Public Property StarHeight() As Integer
            Get
                Return _starheight
            End Get
            Set(ByVal value As Integer)
                _starheight = value
            End Set
        End Property
     
     
        Public Property StarAlignment() As DataGridViewContentAlignment
            Get
                Return _staralignment
            End Get
            Set(ByVal value As DataGridViewContentAlignment)
                _staralignment = value
            End Set
        End Property
     
        Public Overrides Function Clone() As Object
            Dim Cell As DataGridViewStarRateCell = DirectCast(MyBase.Clone(), DataGridViewStarRateCell)
            Cell.StarWidth = Me.StarWidth
            Cell.StarHeight = Me.StarHeight
            Cell.StarAlignment = Me.StarAlignment
            Return Cell
        End Function
     
     
        Protected Overrides Sub Paint(ByVal graphics As Graphics, _
            ByVal clipBounds As Rectangle, ByVal cellBounds As Rectangle, _
            ByVal rowIndex As Integer, _
            ByVal elementState As DataGridViewElementStates, _
            ByVal value As Object, ByVal formattedValue As Object, _
            ByVal errorText As String, _
            ByVal cellStyle As DataGridViewCellStyle, _
            ByVal advancedBorderStyle As DataGridViewAdvancedBorderStyle, _
            ByVal paintParts As DataGridViewPaintParts)
     
            MyBase.Paint(graphics, clipBounds, cellBounds, rowIndex, elementState, Nothing, Nothing, errorText, cellStyle, advancedBorderStyle, paintParts)
     
            'Set the scaling mode to high quality (makes the stars look good at any size)
            graphics.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
     
            ' dessine le nombre d'étoiles correspondant à la valeur de la cellule
            ' le dessin est limité aux dimensions de la cellule
            Dim starValue As Integer 'valeur de la note
            Dim filledtouse As Image = My.Resources.star_xxl 'une étoile
            Dim height As Integer = filledtouse.Height
            Dim width As Integer = filledtouse.Width
            Dim destRectX, destRectY, destRectWidth, destRectHeight As Integer
            Dim srcRectWidth, srcRectHeight As Integer
            Dim destRect, srcRect As Rectangle
            starValue = value
            ' réglage alignement des étoiles dans la cellule
            Dim offsetX, offsetY As Integer
            Select Case _staralignment
                Case DataGridViewContentAlignment.BottomCenter
                    offsetX = Math.Max(0, (cellBounds.Width - starValue * _starwidth) / 2) ' Center
                    offsetY = Math.Max(0, (cellBounds.Height - _starheight)) 'Bottom
                Case DataGridViewContentAlignment.BottomLeft
                    offsetX = 0 'left
                    offsetY = Math.Max(0, (cellBounds.Height - _starheight)) 'Bottom
                Case DataGridViewContentAlignment.BottomRight
                    offsetX = Math.Max(0, cellBounds.Width - starValue * _starwidth) 'Right
                    offsetY = Math.Max(0, (cellBounds.Height - _starheight)) 'Bottom
                Case DataGridViewContentAlignment.MiddleCenter
                    offsetX = Math.Max(0, (cellBounds.Width - starValue * _starwidth) / 2) ' Center
                    offsetY = Math.Max(0, (cellBounds.Height - _starheight) / 2) ' Middle
                Case DataGridViewContentAlignment.MiddleLeft
                    offsetX = 0 'left
                    offsetY = Math.Max(0, (cellBounds.Height - _starheight) / 2) ' Middle
                Case DataGridViewContentAlignment.MiddleRight
                    offsetX = Math.Max(0, cellBounds.Width - starValue * _starwidth) 'Right
                    offsetY = Math.Max(0, (cellBounds.Height - _starheight) / 2) ' Middle
                Case DataGridViewContentAlignment.TopCenter
                    offsetX = Math.Max(0, (cellBounds.Width - starValue * _starwidth) / 2) ' Center
                    offsetY = 0 'top
                Case DataGridViewContentAlignment.TopLeft, DataGridViewContentAlignment.NotSet
                    offsetX = 0 'left
                    offsetY = 0 'top
                Case DataGridViewContentAlignment.TopRight
                    offsetX = Math.Max(0, cellBounds.Width - starValue * _starwidth) 'Right
            End Select
     
            For i = 1 To starValue
                destRectX = cellBounds.X + offsetX + (i - 1) * _starwidth
                destRectY = cellBounds.Y + offsetY
                destRectWidth = Math.Min(_starwidth, cellBounds.Width - (i - 1) * _starwidth) - 1
                destRectHeight = Math.Min(cellBounds.Height, _starheight) - 1
                srcRectWidth = width / _starwidth * destRectWidth
                srcRectHeight = height * Math.Min(cellBounds.Height / _starheight, 1)
                destRect = New Rectangle(destRectX, destRectY, destRectWidth, destRectHeight)
                srcRect = New Rectangle(0, 0, srcRectWidth, srcRectHeight)
                graphics.DrawImage(filledtouse, destRect, srcRect, GraphicsUnit.Pixel)
            Next
     
        End Sub
     
    End Class

  20. #20
    Modérateur

    Homme Profil pro
    Inscrit en
    Janvier 2007
    Messages
    1 722
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Janvier 2007
    Messages : 1 722
    Points : 5 100
    Points
    5 100
    Par défaut
    Citation Envoyé par noftal Voir le message
    C'est de la bombe, ce lien !

    Grâce à lui, j'ai réussi à faire fonctionner le bignou.
    C'est plutôt plus simple que précédemment.

    Je me hâte de partager le code en supprimant tout ce qui n'est plus utile (notamment les attributs)
    J'ai eu un mal fou à le trouver.
    Je pense que les attributs doivent être hérité automatiquement.
    Merci pour le partage (et de rien pour l'aide, c'était avec plaisir (j'ai aussi appris des trucs))).
    Traductions d'articles :
    La mémoire en .NET - Qu'est-ce qui va où ?
    Architecture DAL de haute performance et DTO ; Version C# : Partie 1,Partie 2,Partie 3 — Version VB.NET : Partie 1,Partie 2,Partie 3
    N'hésitez pas à consulter la FAQ VB.NET, le cours complet de Philippe Lasserre et tous les cours, articles et tutoriels.

+ Répondre à la discussion
Cette discussion est résolue.
Page 1 sur 2 12 DernièreDernière

Discussions similaires

  1. Réponses: 10
    Dernier message: 27/10/2014, 13h50
  2. Binder un élément et pas une propriété
    Par Flaburgan dans le forum Windows Presentation Foundation
    Réponses: 11
    Dernier message: 27/02/2013, 15h37
  3. Réponses: 11
    Dernier message: 23/05/2011, 02h26
  4. Réponses: 1
    Dernier message: 08/11/2010, 11h24
  5. Réponses: 1
    Dernier message: 08/01/2009, 11h23

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