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

Composants VCL Delphi Discussion :

[DXE7] Comment modifier la couleur de fond de l'en-tête d'une DBGrid ?


Sujet :

Composants VCL Delphi

  1. #1
    Expert éminent
    Avatar de Lung
    Profil pro
    Analyste-programmeur
    Inscrit en
    Mai 2002
    Messages
    2 663
    Détails du profil
    Informations personnelles :
    Âge : 43
    Localisation : France, Haute Savoie (Rhône Alpes)

    Informations professionnelles :
    Activité : Analyste-programmeur
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2002
    Messages : 2 663
    Points : 6 949
    Points
    6 949
    Par défaut [DXE7] Comment modifier la couleur de fond de l'en-tête d'une DBGrid ?
    Comment modifier la couleur de fond de l'en-tête d'une DBGrid ?

    Dans l'évènement OnDrawColumnCell, on a accès à toutes les cellules, mais pas celles de l'en-tête : state n'est jamais à gdFixed.
    (Confirmé par https://www.developpez.net/forums/d1...d/#post6244388)

    J'ai trouvé une bidouille qui marche à moitié, et qui ne me satisfait pas :
    Dessiner avec le Canvas.Pen après l'appel à DefaultDrawColumnCell, au lieu de se contenter de modifier la couleur du Canvas.Brush avant l'appel à DefaultDrawColumnCell.
    Le problème, c'est que si le rendu semble bon lors du premier affichage, il suffit de passer la souris sur une en-tête de colonne pour qu'elle se redessine avec la couleur par défaut (donc dans ce cas là, ça ne fait pas appel au OnDrawColumnCell ).

    Quelqu'un aurait-il une idée ?
    L'urgent est fait, l'impossible est en cours, pour les miracles prévoir un délai. ___ Écrivez dans un français correct !!

    C++Builder 5 - Delphi 6#2 Entreprise - Delphi 2007 Entreprise - Delphi 2010 Architecte - Delphi XE Entreprise - Delphi XE7 Entreprise - Delphi 10 Entreprise - Delphi 10.3.2 Entreprise - Delphi 10.4.2 Entreprise
    OpenGL 2.1 - Oracle 10g - Paradox - Interbase (XE) - PostgreSQL (11.6 - 14.6)

  2. #2
    Expert éminent sénior
    Avatar de ShaiLeTroll
    Homme Profil pro
    Développeur C++\Delphi
    Inscrit en
    Juillet 2006
    Messages
    13 429
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Seine Saint Denis (Île de France)

    Informations professionnelles :
    Activité : Développeur C++\Delphi
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juillet 2006
    Messages : 13 429
    Points : 24 794
    Points
    24 794
    Par défaut
    En DefaultDrawing à False, tu as plus de possibilité ou c'est encore juste les données ?
    Du coup, il faut tout dessiner soi-même en DefaultDrawing

    Je ne change pas la couleur mais j'ajoute une petite flèche à mon DBGrid
    Peut-être qu'un artifice similaire pourrait remplacer la couleur chez toi

    j'ai eu un code qui le faisait la couleur en C++Builder, si je le retrouve ...
    Je me demande si il n'y avait une rédéfinition à l'arrache de DrawCellBackground (via une TDBGrid = class(Vcl.Grids.TDBGrid) )

    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
     
    type
      TDBGridSliteSortAssistant = class(TObject)
      public
        type
          TOnBeforeSortEvent = procedure(AColumn: TColumn; var AAllowedSort: Boolean) of object;
      strict private
        type
          TSortedColumn = record
            Column: TColumn;
            Order: TDBGridSliteHelperSortDirection;
            FlagColumnMoved: Boolean;
          end;
      strict private
        FDBGrid: TDBGrid;
        FDataSetProxy: Datasnap.DBClient.TClientDataSet;
        FDataSetProvider: Datasnap.Provider.TDataSetProvider;
        FSortedColumn: TSortedColumn;
        FOnBeforeSort: TOnBeforeSortEvent;
        FOriginalDataSet: TDataSet;
        FOriginalWndMethod: TWndMethod;
        FOriginalColumnMovedEventHandler: Vcl.Grids.TMovedEvent;
        FOriginalTitleClickEventHandler: TDBGridClickEvent;
        procedure ColumnMovedEventHandler(Sender: TObject; FromIndex, ToIndex: Integer);
        procedure TitleClickEventHandler(Column: TColumn);
        procedure NewWndMethod(var Message: TMessage);
        function IsAllowedSort(Column: TColumn): Boolean;
        procedure SetOriginalDataSet(Value: TDataSet);
        function RAZSort(): TDBGridSliteHelperSortDirection;
        function GetColumnOrdered(): TColumn;
        procedure SetColumnOrdered(Column: TColumn);
      public
        constructor Create(ADBGrid: TDBGrid);
        destructor Destroy(); override;
     
        procedure Refresh();
     
        property DataSet: TDataSet read FOriginalDataSet write SetOriginalDataSet;
        property DataSetOrdered: TClientDataSet read FDataSetProxy;
        property ColumnOrdered: TColumn read GetColumnOrdered write SetColumnOrdered;
     
        property OnBeforeSort: TOnBeforeSortEvent read FOnBeforeSort write FOnBeforeSort;
      end;
    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
    218
    { TDBGridSliteSortAssistant }
     
    //------------------------------------------------------------------------------
    procedure TDBGridSliteSortAssistant.ColumnMovedEventHandler(Sender: TObject; FromIndex, ToIndex: Integer);
    begin
      // La Colonne en deplacement est celle du Tri en cours
      if FSortedColumn.Column = FDBGrid.Columns[ToIndex] then
      begin
        FDBGrid.DrawColumnArrowSort(FDBGrid.Columns.Items[ToIndex], FSortedColumn.Order);
        FSortedColumn.FlagColumnMoved := FromIndex <> ToIndex;
      end
      else
      begin
        // La Colonne qui sera remplacée est celle du Tri en cours
        if FSortedColumn.Column = FDBGrid.Columns[ToIndex] then
        begin
          FDBGrid.DrawColumnArrowSort(FDBGrid.Columns.Items[FromIndex], FSortedColumn.Order);
          FSortedColumn.FlagColumnMoved := FromIndex <> ToIndex;
        end;
      end;
     
      if Assigned(FOriginalColumnMovedEventHandler) then
        FOriginalColumnMovedEventHandler(Sender, FromIndex, ToIndex);
    end;
     
    //------------------------------------------------------------------------------
    constructor TDBGridSliteSortAssistant.Create(ADBGrid: TDBGrid);
    const
      ERR_UNASSISTED_CLASS = 'La Classe d''Assistance %s n''accepte que les instance de la classe %s';
      DEFAULT_PACKET_RECORDS = 25; // 25 lignes visibles dans une DBGrid, c'est une valeur généralement utilisée
    begin
      inherited Create();
     
      if not Assigned(ADBGrid) then
        raise Exception.CreateFmt(ERR_UNASSISTED_CLASS, [ClassName(), TDBGrid.ClassName()]);
     
      FDBGrid := ADBGrid;
     
      FOriginalWndMethod := FDBGrid.WindowProc;
      FDBGrid.WindowProc := NewWndMethod;
     
      FOriginalColumnMovedEventHandler := FDBGrid.OnColumnMoved;
      FDBGrid.OnColumnMoved := ColumnMovedEventHandler;
     
      FOriginalTitleClickEventHandler := FDBGrid.OnTitleClick;
      FDBGrid.OnTitleClick := TitleClickEventHandler;
     
      FDataSetProxy := Datasnap.DBClient.TClientDataSet.Create(nil);
      FDataSetProvider := Datasnap.Provider.TDataSetProvider.Create(nil);
      FDataSetProxy.SetProvider(FDataSetProvider);
      if TDBGridSliteHack(ADBGrid).DefaultRowHeight > 0 then
        FDataSetProxy.PacketRecords := System.Math.Ceil(ADBGrid.Height / TDBGridSliteHack(ADBGrid).DefaultRowHeight)
      else
        FDataSetProxy.PacketRecords := DEFAULT_PACKET_RECORDS;
     
      if Assigned(FDBGrid) and Assigned(FDBGrid.DataSource) then
      begin
        FOriginalDataSet := FDBGrid.DataSource.DataSet;
        FDataSetProvider.DataSet := FOriginalDataSet;
        FDBGrid.DataSource.DataSet := FDataSetProxy;
        if Assigned(FOriginalDataSet) then
        begin
          FDataSetProxy.Open();
          // Attribuez la valeur false à LogChanges si vous n'avez pas l'intention de mettre à jour la base de données avec les modifications de l'ensemble de données client
          FDataSetProxy.LogChanges := False;
        end;
      end;
    end;
     
    //------------------------------------------------------------------------------
    destructor TDBGridSliteSortAssistant.Destroy();
    begin
      if Assigned(FDBGrid) and Assigned(FDBGrid.DataSource) and Assigned(FDataSetProvider) then
        FDBGrid.DataSource.DataSet := FOriginalDataSet;
     
      FreeAndNil(FDataSetProxy);
      FreeAndNil(FDataSetProvider);
     
      FOriginalColumnMovedEventHandler := FDBGrid.OnColumnMoved;
      FOriginalTitleClickEventHandler := FDBGrid.OnTitleClick;
     
      if Assigned(FDBGrid) then
        FDBGrid.WindowProc := FOriginalWndMethod;
     
      inherited Destroy();
    end;
     
    //------------------------------------------------------------------------------
    function TDBGridSliteSortAssistant.GetColumnOrdered(): TColumn;
    begin
      Result := FSortedColumn.Column;
    end;
     
    //------------------------------------------------------------------------------
    function TDBGridSliteSortAssistant.IsAllowedSort(Column: TColumn): Boolean;
    begin
      Result := True;
      if Assigned(FOnBeforeSort) then
        FOnBeforeSort(Column, Result);
    end;
     
    //------------------------------------------------------------------------------
    procedure TDBGridSliteSortAssistant.NewWndMethod(var Message: TMessage);
    begin
      FOriginalWndMethod(Message);
     
      if (Message.Msg = WM_HSCROLL) or (Message.Msg = WM_SIZE) then
        if Assigned(FSortedColumn.Column) then
          FDBGrid.DrawColumnArrowSort(FSortedColumn.Column, FSortedColumn.Order);
    end;
     
    //------------------------------------------------------------------------------
    function TDBGridSliteSortAssistant.RAZSort(): TDBGridSliteHelperSortDirection;
    begin
      Result := FSortedColumn.Order;
     
      if Assigned(FDBGrid) then
        FDBGrid.DrawColumnArrowSort(nil, sdNone);
     
      FSortedColumn.Column := nil;
      FSortedColumn.Order := sdNone;
      FSortedColumn.FlagColumnMoved := False;
     
      if FDataSetProxy.IndexName <> '' then
        FDataSetProxy.IndexName := '';
      FDataSetProxy.IndexDefs.Clear();
    end;
     
    //------------------------------------------------------------------------------
    procedure TDBGridSliteSortAssistant.Refresh();
    begin
      if Assigned(FDataSetProvider) and Assigned(FDataSetProvider.DataSet) and Assigned(FDataSetProxy) and FDataSetProxy.Active then
        FDataSetProxy.Refresh();
    end;
     
    //------------------------------------------------------------------------------
    procedure TDBGridSliteSortAssistant.SetColumnOrdered(Column: TColumn);
    var
      OldOrder: TDBGridSliteHelperSortDirection;
      IndexName: String;
    begin
      // Remise à zéro du tri en cours
      OldOrder := RAZSort();
     
      if Assigned(FDBGrid) and Assigned(Column) and (Column.Grid = FDBGrid) and FDataSetProxy.Active then
      begin
        // Est-ce bien une Colonne Triable ?
        if Assigned(Column.Field) and IsAllowedSort(Column) then
        begin
          // Changement de l'ordre de tri selon celui qui était actif précédemment
          case OldOrder of
            sdNone, sdDescending :
              begin
                FSortedColumn.Column := Column;
                FSortedColumn.Order := sdAscending;
                FDBGrid.DrawColumnArrowSort(FSortedColumn.Column, sdAscending); // Attention, cela modifie la propriété Width
                IndexName := Copy('ASC_' + Column.FieldName, 1, 30); // 30 = Taille maximum
                FDataSetProxy.AddIndex(IndexName, Column.FieldName, [ixCaseInsensitive]);
              end;
     
            sdAscending :
              begin
                FSortedColumn.Column := Column;
                FSortedColumn.Order := sdDescending;
                FDBGrid.DrawColumnArrowSort(FSortedColumn.Column, sdDescending); // Attention, cela modifie la propriété Width
                IndexName := Copy('DESC_' + Column.FieldName, 1, 30); // 30 = Taille maximum
                FDataSetProxy.AddIndex(IndexName, Column.FieldName, [ixDescending, ixCaseInsensitive]);
              end;
          end;
        end;
     
        // Application du Tri !
        try
          FDataSetProxy.IndexDefs.Update();
          FDataSetProxy.IndexName := IndexName;
        except
          RAZSort();
        end;
      end;
    end;
     
    //------------------------------------------------------------------------------
    procedure TDBGridSliteSortAssistant.SetOriginalDataSet(Value: TDataSet);
    begin
      FOriginalDataSet := Value;
     
      if Assigned(FDataSetProvider.DataSet) then
        FDataSetProxy.Close();
      RAZSort();
     
      FDataSetProvider.DataSet := Value;
      if Assigned(FDBGrid) and Assigned(FDBGrid.DataSource) and Assigned(Value) then
      begin
        if not Assigned(FDBGrid.DataSource.DataSet) then
          FDBGrid.DataSource.DataSet := FDataSetProxy;
     
        FDataSetProxy.Close();
        FDataSetProxy.SetProvider(FDataSetProvider);
        FDataSetProxy.Open();
        // Attribuez la valeur false à LogChanges si vous n'avez pas l'intention de mettre à jour la base de données avec les modifications de l'ensemble de données client
        FDataSetProxy.LogChanges := False;
      end;
    end;
     
    //------------------------------------------------------------------------------
    procedure TDBGridSliteSortAssistant.TitleClickEventHandler(Column: TColumn);
    begin
      // Protection contre le déplacement de colonne
      if FSortedColumn.FlagColumnMoved then begin
        FSortedColumn.FlagColumnMoved := False;
        Exit;
      end;
     
      SetColumnOrdered(Column);
     
      if Assigned(FOriginalTitleClickEventHandler) then
        FOriginalTitleClickEventHandler(Column);
    end;
    Aide via F1 - FAQ - Guide du développeur Delphi devant un problème - Pensez-y !
    Attention Troll Méchant !
    "Quand un homme a faim, mieux vaut lui apprendre à pêcher que de lui donner un poisson" Confucius
    Mieux vaut se taire et paraître idiot, Que l'ouvrir et de le confirmer !
    L'ignorance n'excuse pas la médiocrité !

    L'expérience, c'est le nom que chacun donne à ses erreurs. (Oscar Wilde)
    Il faut avoir le courage de se tromper et d'apprendre de ses erreurs

  3. #3
    Expert éminent
    Avatar de Lung
    Profil pro
    Analyste-programmeur
    Inscrit en
    Mai 2002
    Messages
    2 663
    Détails du profil
    Informations personnelles :
    Âge : 43
    Localisation : France, Haute Savoie (Rhône Alpes)

    Informations professionnelles :
    Activité : Analyste-programmeur
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2002
    Messages : 2 663
    Points : 6 949
    Points
    6 949
    Par défaut
    Citation Envoyé par ShaiLeTroll Voir le message
    En DefaultDrawing à False, tu as plus de possibilité ou c'est encore juste les données ?
    J'ai essayé, mais ça ne change rien vu que j'utilisais DefaultDrawColumnCell.

    Citation Envoyé par ShaiLeTroll Voir le message
    Je ne change pas la couleur mais j'ajoute une petite flèche à mon DBGrid
    Peut-être qu'un artifice similaire pourrait remplacer la couleur chez toi
    Je le fais aussi pour indiquer la colonne triée.
    Et, j'ai le même effet : quand je passe la souris par-dessus, la flèche disparait (le OnDrawColumnCell n'est pas appelé).

    Citation Envoyé par ShaiLeTroll Voir le message
    j'ai eu un code qui le faisait la couleur en C++Builder, si je le retrouve ...
    Toutes les pistes sont bonnes à creuser ...

    Citation Envoyé par ShaiLeTroll Voir le message
    Je me demande si il n'y avait une rédéfinition à l'arrache de DrawCellBackground (via une TDBGrid = class(Vcl.Grids.TDBGrid) )
    Je l'avais vu, et j'ai essayé de jouer avec. Mais ma surcharge n'était pas appelée (mais je m'y étais peut-être mal pris).
    L'urgent est fait, l'impossible est en cours, pour les miracles prévoir un délai. ___ Écrivez dans un français correct !!

    C++Builder 5 - Delphi 6#2 Entreprise - Delphi 2007 Entreprise - Delphi 2010 Architecte - Delphi XE Entreprise - Delphi XE7 Entreprise - Delphi 10 Entreprise - Delphi 10.3.2 Entreprise - Delphi 10.4.2 Entreprise
    OpenGL 2.1 - Oracle 10g - Paradox - Interbase (XE) - PostgreSQL (11.6 - 14.6)

  4. #4
    Expert éminent sénior
    Avatar de ShaiLeTroll
    Homme Profil pro
    Développeur C++\Delphi
    Inscrit en
    Juillet 2006
    Messages
    13 429
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Seine Saint Denis (Île de France)

    Informations professionnelles :
    Activité : Développeur C++\Delphi
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juillet 2006
    Messages : 13 429
    Points : 24 794
    Points
    24 794
    Par défaut
    Ma flèche est elle par dessus le Grid et pas dessiné dans le Grid, je n'ai pas donné tout le code

    le TDBGridSliteSortAssistant utilise le TDBGridSliteHelper qui utilise TDBGridSLTAssistant

    il y un TArrowImage qui est un TPanel contenant un TImage qui prend le TDBGrid comme Parent
    J'ai recyclé un code de 2002 en D7 qui devait fonctionner à l'époque aussi en D3

    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
     
      TDBGridSliteHelperSortDirection = (sdNone, sdAscending, sdDescending);
      TDBGridSliteHelper = class helper for TDBGrid
      public
        function EditButtonShowDateEditor(const Msg: string; AField: TField): Boolean;
        function EllipsisButtonShowComboEditor(const Msg: string; AColumn: TColumn; var AIndex: Integer): Boolean;
        procedure DrawCheckBox(const Rect: TRect; Checked: Boolean; AEnabled: Boolean = True; ABackgroundColor: TColor = clNone);
        procedure DrawEllipsisButton(const Rect: TRect; ABackgroundColor: TColor = clNone; AColumn: TColumn = nil; State: TGridDrawState = []);
        function HitOnEllipsisButton(Column: TColumn): Boolean;
        procedure DrawTextWithBackgroundColor(ABackgroundColor: TColor; const Rect: TRect; Column: TColumn; State: TGridDrawState);
        function HitOnTitle(out Column: TColumn): Boolean;
        function HitOnColumnCell(out Column: TColumn): Boolean;
        function GetTotalWidth(): Integer;
        function GetColumnTotalWidth(): Integer;
        function GetColumnBounds(const AColumn: TColumn): TRect;
        function GetColumnByID(AID: Integer): TColumn;
        function GetTheoricRowHeight(): Integer;
     
        procedure DrawColumnArrowSort(const AColumn: TColumn; ASortDirection: TDBGridSliteHelperSortDirection);
     
        function GetThemedBackgroundColor(): TColor;
        function ThemeUseColumnColor(): Boolean;
        procedure ZoomColumnTitleWidth(AZoomPourcent: Integer);
     
        procedure ViewInExcel(const ASheetName: string; AOnProgress: TNotifyEvent = nil; AOnBeforeActivateExcel: TNotifyEvent = nil; AShowWaitMessage: Boolean = True; ACellWithBorder: Boolean = False);
      end;
    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
    { TDBGridSliteHelper }
     
    type
      TDBGridSliteHack = class(TDBGrid);
     
     
    //------------------------------------------------------------------------------
    procedure TDBGridSliteHelper.DrawCheckBox(const Rect: TRect; Checked: Boolean; AEnabled: Boolean = True; ABackgroundColor: TColor = clNone);
    begin
      with TDBGridSLTAssistant.Create(Self) do
      try
        DrawCheckBox(Rect, Checked, AEnabled, ABackgroundColor);
      finally
        Free();
      end;
    end;
     
    //------------------------------------------------------------------------------
    procedure TDBGridSliteHelper.DrawColumnArrowSort(const AColumn: TColumn; ASortDirection: TDBGridSliteHelperSortDirection);
    var
      csd: TDBGridSLTAssistant.TColumnSortDirection;
    begin
      with TDBGridSLTAssistant.Create(Self) do
      try
        csd := csdNone;
        if ASortDirection = sdAscending then
          csd := csdAscending
        else if ASortDirection = sdDescending then
          csd := csdDescending;
     
        DrawColumnArrowSort(AColumn, csd);
      finally
        Free();
      end;
    end;
     
    //------------------------------------------------------------------------------
    procedure TDBGridSliteHelper.DrawEllipsisButton(const Rect: TRect; ABackgroundColor: TColor = clNone; AColumn: TColumn = nil; State: TGridDrawState = []);
    begin
      with TDBGridSLTAssistant.Create(Self) do
      try
        DrawEllipsisButton(Rect, ABackgroundColor, AColumn, State);
      finally
        Free();
      end;
    end;
     
    //------------------------------------------------------------------------------
    procedure TDBGridSliteHelper.DrawTextWithBackgroundColor(ABackgroundColor: TColor; const Rect: TRect; Column: TColumn; State: TGridDrawState);
    begin
      with TDBGridSLTAssistant.Create(Self) do
      try
        DrawTextWithBackgroundColor(ABackgroundColor, Rect, Column, State);
      finally
        Free();
      end;
    end;
     
    //------------------------------------------------------------------------------
    function TDBGridSliteHelper.EditButtonShowDateEditor(const Msg: string; AField: TField): Boolean;
    begin
      with TDBGridSLTAssistant.Create(Self) do
      try
        Result := EditButtonInputDatePicker(Msg, AField);
      finally
        Free();
      end;
    end;
     
    //------------------------------------------------------------------------------
    function TDBGridSliteHelper.EllipsisButtonShowComboEditor(const Msg: string; AColumn: TColumn; var AIndex: Integer): Boolean;
    begin
      with TDBGridSLTAssistant.Create(Self) do
      try
        Result := ShowCombo(Msg, AColumn.PickList, AIndex);
      finally
        Free();
      end;
    end;
     
    //------------------------------------------------------------------------------
    function TDBGridSliteHelper.GetColumnBounds(const AColumn: TColumn): TRect;
    var
      ColR: TRect;
    begin
      with TDBGridSLTAssistant.Create(Self) do
      try
        ColR := GetColumnScreenRect(AColumn);
        Result.TopLeft := Self.ScreenToClient(ColR.TopLeft);
        Result.BottomRight := Self.ScreenToClient(ColR.BottomRight);
      finally
        Free();
      end;
    end;
     
    //------------------------------------------------------------------------------
    function TDBGridSliteHelper.GetColumnTotalWidth(): Integer;
    var
      I: Integer;
    begin
      Result := 0;
      for I := 0 to Self.Columns.Count - 1 do
        Inc(Result, Self.Columns[I].Width);
     
      if dgColLines in Self.Options then
        Inc(Result, Self.Columns.Count);
    end;
     
    //------------------------------------------------------------------------------
    function TDBGridSliteHelper.GetColumnByID(AID: Integer): TColumn;
    var
      I: Integer;
    begin
      for I := 0 to Self.Columns.Count - 1 do
        if Self.Columns[I].ID = AID then
          Exit(Self.Columns[I]);
     
      Result := nil;
    end;
     
    //------------------------------------------------------------------------------
    function TDBGridSliteHelper.GetThemedBackgroundColor(): TColor;
    begin
      with TDBGridSLTAssistant.Create(Self) do
      try
        Result := GetThemedBackgroundColor();
      finally
        Free();
      end;
    end;
     
    //------------------------------------------------------------------------------
    function TDBGridSliteHelper.GetTheoricRowHeight(): Integer;
    begin
      Result := TDBGridSliteHack(Self).DefaultRowHeight;
    end;
     
    //------------------------------------------------------------------------------
    function TDBGridSliteHelper.GetTotalWidth(): Integer;
    begin
      Result := GetColumnTotalWidth() + GetSystemMetrics(SM_CXVSCROLL);
      if dgIndicator in Self.Options then
        Inc(Result, GetSystemMetrics(SM_CXVSCROLL));
    end;
     
    //------------------------------------------------------------------------------
    function TDBGridSliteHelper.HitOnColumnCell(out Column: TColumn): Boolean;
    begin
      with TDBGridSLTAssistant.Create(Self) do
      try
        Result := HitOnColumnCell(Column);
      finally
        Free();
      end;
    end;
     
    //------------------------------------------------------------------------------
    function TDBGridSliteHelper.HitOnEllipsisButton(Column: TColumn): Boolean;
    begin
      with TDBGridSLTAssistant.Create(Self) do
      try
        Result := HitOnEllipsisButton(Column);
      finally
        Free();
      end;
    end;
     
    //------------------------------------------------------------------------------
    function TDBGridSliteHelper.HitOnTitle(out Column: TColumn): Boolean;
    begin
      with TDBGridSLTAssistant.Create(Self) do
      try
        Result := HitOnTitle(Column);
      finally
        Free();
      end;
    end;
     
    //------------------------------------------------------------------------------
    function TDBGridSliteHelper.ThemeUseColumnColor(): Boolean;
    begin
      Result := TDBGridSLTAssistant.ThemeUseColumnColor;
    end;
     
    //------------------------------------------------------------------------------
    procedure TDBGridSliteHelper.ViewInExcel(const ASheetName: string; AOnProgress: TNotifyEvent = nil; AOnBeforeActivateExcel: TNotifyEvent = nil; AShowWaitMessage: Boolean = True; ACellWithBorder: Boolean = False);
    var
      FieldsNames, Titles: array of string;
      Column: TColumn;
      I, L: Integer;
    begin
      if Assigned(Self.DataSource.DataSet) and Self.DataSource.DataSet.Active then
      begin
        L := Self.Columns.Count;
        SetLength(FieldsNames, L);
        SetLength(Titles, L);
        for I := 0 to L - 1 do
        begin
          Column := Self.Columns[I];
          FieldsNames[I] := Column.FieldName;
          Titles[I] := Column.Title.Caption;
        end;
     
        Self.DataSource.DataSet.ViewInExcel(ASheetName+'_'+FormatDateTime('YYYY-MM-DD', Now()), FieldsNames, Titles, AOnProgress, AOnBeforeActivateExcel);
      end;
    end;
     
    //------------------------------------------------------------------------------
    procedure TDBGridSliteHelper.ZoomColumnTitleWidth(AZoomPourcent: Integer);
    begin
      with TDBGridSLTAssistant.Create(Self) do
      try
        ZoomColumnTitleWidth(AZoomPourcent);
      finally
        Free();
      end;
    end;

    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
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    694
    695
    696
    697
    698
    699
    700
    701
    702
    703
    704
    705
    706
    707
    708
    709
    710
    711
    712
    713
    714
    715
    716
    717
    718
    719
    720
    721
    722
    723
    724
    725
    726
    727
    728
    729
    730
    731
    732
    733
    734
    735
    736
    737
    738
    739
    740
    741
    742
    743
    744
    745
    746
    747
    748
    749
    750
    751
    752
    753
    754
    755
    756
    757
    758
    759
    760
    761
    762
    763
     
    //------------------------------------------------------------------------------
    (*                SoLuTions is an Versatile Library for Delphi                 -
     *                                                                             -
     *  Version alternative publiée sur "www.developpez.net"                       -
     *  Post : "Glyph, bmp ou autre dans Title DBGrid "                            -
     *  Post Number : 4016213                                                      -
     *  Post URL = "http://www.developpez.net/forums/d687339/environnements-developpement/delphi/composants-vcl/glyph-bmp-title-dbgrid/#post4016213"
     *                                                                             -
     *  Copyright ou © ou Copr. "SLT Solutions", (2006)                            -
     *  contributeur : ShaiLeTroll (2007) - Passage en Classe d'un code procédural -
     *  contributeur : ShaiLeTroll (2012) - Renommage Fichier et Correction XE2    -
     *  contributeur : ShaiLeTroll (2012) - Gestion des Styles sous C++BuilderXE2  -
     *  contributeur : ShaiLeTroll (2012) - Documentation Insight                  -
     *  contributeur : ShaiLeTroll (2014) - Traduction du code C++Builder vers DelphiXE2
     *                                                                             -
     *                                                                             -
     * Ce logiciel est un programme informatique servant à aider les développeurs  -
     * Delphi avec une bibliothèque polyvalente, adaptable et fragmentable.        -
     *                                                                             -
     * Ce logiciel est régi par la licence CeCILL-C soumise au droit français et   -
     * respectant les principes de diffusion des logiciels libres. Vous pouvez     -
     * utiliser, modifier et/ou redistribuer ce programme sous les conditions      -
     * de la licence CeCILL-C telle que diffusée par le CEA, le CNRS et l'INRIA    -
     * sur le site "http://www.cecill.info".                                       -
     *                                                                             -
     * En contrepartie de l'accessibilité au code source et des droits de copie,   -
     * de modification et de redistribution accordés par cette licence, il n'est   -
     * offert aux utilisateurs qu'une garantie limitée.  Pour les mêmes raisons,   -
     * seule une responsabilité restreinte pèse sur l'auteur du programme,  le     -
     * titulaire des droits patrimoniaux et les concédants successifs.             -
     *                                                                             -
     * A cet égard  l'attention de l'utilisateur est attirée sur les risques       -
     * associés au chargement,  à l'utilisation,  à la modification et/ou au       -
     * développement et à la reproduction du logiciel par l'utilisateur étant      -
     * donné sa spécificité de logiciel libre, qui peut le rendre complexe à       -
     * manipuler et qui le réserve donc à des développeurs et des professionnels   -
     * avertis possédant  des  connaissances  informatiques approfondies.  Les     -
     * utilisateurs sont donc invités à charger  et  tester  l'adéquation  du      -
     * logiciel à leurs besoins dans des conditions permettant d'assurer la        -
     * sécurité de leurs systèmes et ou de leurs données et, plus généralement,    -
     * à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.          -
     *                                                                             -
     * Le fait que vous puissiez accéder à cet en-tête signifie que vous avez      -
     * pris connaissance de la licence CeCILL-C, et que vous en avez accepté les   -
     * termes.                                                                     -
     *                                                                             -
     *----------------------------------------------------------------------------*)
    unit SLT.Controls.VCL.DBGridsEx;
     
    interface
     
    uses
      System.Classes, System.SysUtils, System.Types,
      Vcl.Controls, Vcl.Grids, Vcl.DBGrids, Vcl.Themes, Vcl.Graphics, Vcl.ExtCtrls,
      Data.DB,
      Winapi.Windows,
      SLT.Common.SystemEx;
     
    type
      /// <summary>Erreur liée à l'assistant TDBGridSLTAssistant de la classe TDBGrid</summary>
      EDBGridSLTAssistantError = class(Exception);
     
      /// <summary>Assistance de la classe TDBGrid </summary>
      /// <remarks>Le TDBGridSLTAssistant n'est pas un class helper car lors de sa création en 2002 sous Delphi 5, le code était procédural,
      /// lors de la refonte en classe en 2007 et 2012, les versions utilisées était Delphi 7 et C++Builder 2007 puis C++Builder XE2.
      /// <para>Reprise en Delphi XE2 (en 2014) en s'inspirant du concept des Assistances de classes (Class Helper) du Delphi
      /// tout en conservant une approche OO sous la forme d'une classe externe plus élégant et explicite que les véritables "class helper".</para></remarks>
      TDBGridSLTAssistant = class(TObject)
      public
        type
          TColumnSortDirection = (csdNone, csdAscending, csdDescending);
      strict private
        type
          TDBGridHack = class(TDBGrid);
      private
        // Accesseurs
        class function GetThemeUseColumnColor(): Boolean; static;
      private
        // Membres privés
        FDBGrid: TDBGrid;
     
        function GetColRowScreenRect(ACol, ARow: Longint): TRect;
      public
        // Constructeurs
        constructor Create(ADBGrid: TDBGrid); overload;
        constructor Create(Sender: TObject); overload;
     
        /// <summary>EditButtonInputDatePicker fournit un assistant d'implémentation d'un TDBGrid.OnEditButtonClick</summary>
        function EditButtonInputDatePicker(const Msg: string; AField: TField): Boolean;
     
        /// <summary>EditButtonInputCombo fournit un assistant d'implémentation d'un TDBGrid.OnCellClick gérant manuellement un d'Ellipis avec une grille en ReadOnly</summary>
        /// <param name="Msg">descriptif de la liste déroulante</param>
        /// <param name="APickList">Cela fourni la liste déroulante</param>
        /// <param name="APickListIndex">Cela fourni la valeur courante</param>
        /// <returns>Indique qu'élément a été selectionné dans la liste déroulante</returns>
        function ShowCombo(const Msg: string; APickList: TStrings; var APickListIndex: Integer): Boolean;
     
        /// <summary>DrawCheckBox fournit un assistant d'implémentation d'un TDBGrid.OnDrawColumnCell qui dessine une case à cocher centrée dans la zone définie par ARect</summary>
        /// <param name="ARect">Zone à dessiner</param>
        /// <param name="AChecked">Etat de la case à cocher</param>
        /// <param name="AEnabled">la case à cocher est-elle active</param>
        /// <param name="ABackgroundColor">Couleur de fond, clNone pour utiliser la couleur du thème</param>
        /// <param name="AState">Etat de la cellule d'une grille qui est en cours de restitution</param>
        procedure DrawCheckBox(const ARect: TRect; AChecked: Boolean; AEnabled: Boolean = True; ABackgroundColor: TColor = clNone; AState: TGridDrawState = []);
     
        /// <summary>DrawEllipsisButton fournit un assistant d'implémentation d'un TDBGrid.OnDrawColumnCell qui dessine un bouton '...' dans la zone définie par ARect</summary>
        /// <param name="ARect">Zone à dessiner, la taille et l'alignement sont calculés automatiquement</param>
        /// <param name="ABackgroundColor">Couleur de fond, clNone pour utiliser la couleur du thème</param>
        /// <param name="AColumn">La colonne dont l'on souhaite avoir un bouton '...'</param>
        /// <param name="AState">Etat de la cellule d'une grille qui est en cours de restitution</param>
        procedure DrawEllipsisButton(const ARect: TRect; ABackgroundColor: TColor = clNone; AColumn: TColumn = nil; AState: TGridDrawState = []);
     
        /// <summary>HitOnEllipsisButton fournit un assistant d'implémentation d'un TDBGrid.CellClick avec un bouton '...'</summary>
        /// <param name="AColumn">La colonne avec un bouton '...'</param>
        /// <returns>Indique que la souris est sur le bouton</returns>
        function HitOnEllipsisButton(AColumn: TColumn): Boolean;
     
        /// <summary>GetColumnScreenRect fournit un assistant d'implémentation d'un TDBGrid.OnCellClick qui donne la position et dimension de la cellule</summary>
        /// <param name="AColumn">La colonne dont l'on souhaite connaitre la position</param>
        /// <returns>la position du bouton en coordonnées écran de la grille TDBGrid possédant cette TColumn, ces coordonnées écran sont compatibles avec le curseur de la souris idéal pour la fonction PtInRects.</returns>
        function GetColumnScreenRect(const AColumn: TColumn): TRect;
     
        /// <summary>GetColumnTitleScreenRect fournit un assistant d'implémentation d'un TDBGrid.OnTitleClick qui donne la position et dimension du titre de la colonne</summary>
        /// <param name="AColumn">La colonne dont l'on souhaite connaitre la position du titre</param>
        /// <returns>la position du bouton en coordonnées écran de la grille TDBGrid possédant cette TColumn, ces coordonnées écran sont compatibles avec le curseur de la souris idéal pour la fonction PtInRects.</returns>
        function GetColumnTitleScreenRect(const AColumn: TColumn): TRect;
     
        /// <summary>GetEllipsisButtonRect fournit un assistant d'implémentation d'un TDBGrid.OnCellClick qui donne la position théorique d'un bouton '...'</summary>
        /// <param name="AColumn">La colonne dans lequel pourrait exister un bouton dît ellipse, la taille et l'alignement sont calculés automatiquement</param>
        /// <returns>la position du bouton en coordonnées écran de la grille TDBGrid possédant cette TColumn, ces coordonnées écran sont compatibles avec le curseur de la souris idéal pour la fonction PtInRects.</returns>
        function GetEllipsisButtonScreenRect(const AColumn: TColumn): TRect;
     
        /// <summary>HitOnTitle permet de déterminer si la souris est sur la ligne des titres de colonnes </summary>
        /// <param name="AColumn">La colonne sous la souris</param>
        /// <returns>Indique que la souris est sur la ligne des titres de colonnes</returns>
        function HitOnTitle(out AColumn: TColumn): Boolean;
     
        /// <summary>HitOnColumnCell permet de déterminer la colonne sous la souris en excluant la ligne des titres </summary>
        /// <param name="AColumn">La colonne sous la souris</param>
        /// <returns>Indique que la souris est dans une cellule de donnée</returns>
        function HitOnColumnCell(out AColumn: TColumn): Boolean;
     
        /// <summary>DrawTextWithBackgroundColor fournit un assistant d'implémentation d'un TDBGrid.OnDrawColumnCell qui dessine un texte et un fond coloré dans la zone définie par ARect</summary>
        /// <param name="ABackgroundColor">Couleur de fond, la couleur inverse sera utilisé pour le texte pour garantir le constrate</param>
        /// <param name="ARect">Zone à dessiner</param>
        /// <param name="AColumn">Indique la colonne concerné cela donne accès à la donnée via Field et aux informations tel que Alignment</param>
        /// <param name="AState">Le paramètre AState indique si la cellule a la focalisation et si la cellule est une cellule fixe de la partie immobile de la grille</param>
        procedure DrawTextWithBackgroundColor(ABackgroundColor: TColor; const ARect: TRect; AColumn: TColumn; AState: TGridDrawState);
     
        /// <summary>DrawColumnArrowSort fournit un assistant d'implémentation d'un TDBGrid.OnTitleClick qui gère le dessin d'une fleche marquant un tri sur une colonne</summary>
        /// <param name="AColumn">Indique la colonne concernée cela donne accès à la donnée via Field et aux informations tel que Title.Caption</param>
        /// <param name="ASortDirection">Sens du tri</param>
        procedure DrawColumnArrowSort(const AColumn: TColumn; ASortDirection: TColumnSortDirection);
     
        /// <summary>GetThemedBackgroundColor renvoie la couleur de fond d'une TDBGrid dans le thème actif</summary>
        function GetThemedBackgroundColor(): TColor;
     
        // Méthodes d'ergonomie
        procedure ZoomColumnTitleWidth(AZoomPourcent: Integer);
     
        // Propriétés
        property DBGrid: TDBGrid read FDBGrid;
      public
        class property ThemeUseColumnColor: Boolean read GetThemeUseColumnColor;
      end;
     
    implementation
     
    uses System.Math,
      SLT.Controls.VCL.DialogsEx, SLT.Controls.VCL.GraphicsEx, SLT.Common.TypesEx;
     
    const
      ERR_UNASSISTED_CLASS = 'La Classe d''Assistance %s ne prend pas en charge la classe %s mais la classe %s';
     
    { TDBGridSLTAssistant }
     
    //------------------------------------------------------------------------------
    constructor TDBGridSLTAssistant.Create(ADBGrid: TDBGrid);
    begin
      inherited Create();
     
      FDBGrid := ADBGrid;
    end;
     
    //------------------------------------------------------------------------------
    constructor TDBGridSLTAssistant.Create(Sender: TObject);
    begin
      inherited Create();
     
      if Assigned(Sender) then
      begin
        if Sender is TDBGrid then
          FDBGrid := TDBGrid(Sender)
        else
          raise EDBGridSLTAssistantError.CreateFmt(ERR_UNASSISTED_CLASS, [ClassName(), Sender.ClassName(), TDBGrid.ClassName()]);
      end
      else
        raise EDBGridSLTAssistantError.CreateFmt(ERR_UNASSISTED_CLASS, [ClassName(), '[nil]', TDBGrid.ClassName()])
    end;
     
    //------------------------------------------------------------------------------
    procedure TDBGridSLTAssistant.DrawCheckBox(const ARect: TRect; AChecked: Boolean; AEnabled: Boolean = True; ABackgroundColor: TColor = clNone; AState: TGridDrawState = []);
    const
      CSelected: array[TGridDrawingStyle] of TThemedGrid = (
        tgClassicCellSelected, tgCellSelected, tgGradientCellSelected);
    var
      uState: UINT;
      tbState: TThemedButton;
      Details: TThemedElementDetails;
      StyleColor: TColor;
      Buffer: Vcl.Graphics.TBitmap;
      BufferRect: TRect;
    begin
      if StyleServices.Enabled then
      begin
        // Un bug sur DrawElement d'un TThemedButton dans un DBGrid provoque sur les thèmes foncés une perte de la couleur de fond !
        // En attendant une meilleure solution, j'utilise un Buffer temporaire pour dessiner le ThemedButton CheckBox
        Buffer := Vcl.Graphics.TBitmap.Create();
        try
          BufferRect := Rect(0, 0, ARect.Width, ARect.Height);
          Buffer.SetSize(BufferRect.Width, BufferRect.Height);
     
          if ABackgroundColor = clNone then
          begin
            // On dessine un fond normal assurant normalement un bon constrate avec la CheckBox
            Details := StyleServices.GetElementDetails(tgCellNormal);
            StyleServices.GetElementColor(Details, ecFillColor, StyleColor);
          end
          else
            StyleColor := ABackgroundColor;
     
          // Même si la cellule est sélectionné, on laisse un fond neutre pour mieux voir la CheckBox
          // Force un fond opaque pour cacher le texte !
          Buffer.Canvas.Brush.Color := StyleColor;
          Buffer.Canvas.Brush.Style := bsSolid;
          Buffer.Canvas.FillRect(BufferRect);
     
          tbState := tbCheckBoxUncheckedNormal;
          if AChecked then
            tbState := tbCheckBoxCheckedNormal;
     
          if not AEnabled then
          begin
            if AChecked then
              tbState := tbCheckBoxCheckedDisabled
            else
              tbState := tbCheckBoxUncheckedDisabled;
          end;
     
          Details := StyleServices.GetElementDetails(tbState);
          StyleServices.DrawElement(Buffer.Canvas.Handle, Details, BufferRect, BufferRect);
          // Dessin final
          DBGrid.Canvas.Draw(ARect.Left, ARect.Top, Buffer);
        finally
          Buffer.Free();
        end;
      end
      else
      begin
        uState := DFCS_BUTTONCHECK;
        if AChecked then
          uState := uState or DFCS_CHECKED;
     
        if not AEnabled then
          uState := uState or DFCS_INACTIVE;
     
        DBGrid.Canvas.FillRect(ARect);
        DrawFrameControl(DBGrid.Canvas.Handle, ARect, DFC_BUTTON, uState);
      end;
    end;
     
    //------------------------------------------------------------------------------
    type
      TArrowImage = class(TPanel)
        FImage: TImage;
      public
        constructor Create(AOwner: TComponent); override;
      published
        property Image: TImage read FImage write FImage;
      end;
     
    //------------------------------------------------------------------------------
    constructor TArrowImage.Create(AOwner: TComponent);
    begin
      inherited Create(AOwner);
     
      if AOwner is TWinControl then begin
        Self.Parent := TWinControl(AOwner);
      end;
     
      Self.BevelInner := bvNone;
      Self.BevelOuter := bvNone;
      Self.AutoSize := True;
      Self.ParentColor := False;
      Self.ParentBackground := False;
      Self.Enabled := False;
      Self.Visible := False;
     
      FImage := TImage.Create(Self);
      FImage.Parent := Self;
      FImage.Transparent := False;
      FImage.AutoSize := True;
      FImage.Enabled := False;
    end;
     
    //------------------------------------------------------------------------------
    procedure TDBGridSLTAssistant.DrawColumnArrowSort(const AColumn: TColumn; ASortDirection: TColumnSortDirection);
     
      function GetArrow(): TArrowImage;
      var
        I: Integer;
      begin
        for I := 0 to DBGrid.ComponentCount - 1 do
          if DBGrid.Components[I] is TArrowImage then
            Exit(TArrowImage(DBGrid.Components[I]));
     
        Result := TArrowImage.Create(DBGrid);
      end;
     
    const
      CSelected: array[TGridDrawingStyle] of TThemedGrid = (
        tgClassicCellSelected, tgCellSelected, tgGradientCellSelected);
    var
      Buffer: Vcl.Graphics.TBitmap;
      AllowArrow: Boolean;
      ColumnRect: TRect;
      ColumnTopLeft: TPoint;
      ColumnTitle: string;
      BorderSizeX, BorderSizeY, ArrowSizeX, ArrowSizeY: Integer;
      TextWidth, ArrowPosition: Integer;
      BorderRect, ArrowRect: TRect;
      Arrow: TArrowImage;
      P1, P2, P3: TPoint;
      Triangle: array[0..2] of TPoint;
    begin
      Arrow := GetArrow();
      AllowArrow := Assigned(AColumn) and (ASortDirection <> csdNone);
     
      // Gestion des cas où la fleche ne doit pas être dessiner !
      if AllowArrow then
      begin
        ColumnRect := GetColumnTitleScreenRect(AColumn);
        AllowArrow := ColumnRect.Height > 6;
      end;
     
      // Dessin de la fleche
      if AllowArrow then
      begin
        // j'utilise un Buffer temporaire pour dessiner la fleche
        Buffer := Vcl.Graphics.TBitmap.Create();
        try
          BorderSizeY := ColumnRect.Height - 2;
          ArrowSizeY := BorderSizeY - 4;
          ArrowSizeX := ArrowSizeY * 2 - 1;
          BorderSizeX := ArrowSizeX + 4;
          if (BorderSizeX > 0) and (BorderSizeY > 0)  then
            Buffer.SetSize(BorderSizeX, BorderSizeY)
          else
            Exit;
     
          // Agrandi la colonne en fonction du le libellé
          case AColumn.Title.Alignment of
            taLeftJustify:
              begin
                ColumnTitle := AColumn.Title.Caption;
                TextWidth := TFontSLTToolHelp.GetTextWidth(ColumnTitle, AColumn.Font);
                AColumn.Width := Max(AColumn.Width, TextWidth + BorderSizeX * 2);
                ArrowPosition := TextWidth + BorderSizeX div 2;
              end;
     
            taCenter:
              begin
                ColumnTitle := AColumn.Title.Caption;
                TextWidth := TFontSLTToolHelp.GetTextWidth(ColumnTitle, AColumn.Font);
                AColumn.Width := Max(AColumn.Width, TextWidth + BorderSizeX * 3);
                ArrowPosition := (AColumn.Width + TextWidth + BorderSizeX div 2) div 2;
              end;
     
            taRightJustify:
              begin
                ColumnTitle := AColumn.Title.Caption;
                TextWidth := TFontSLTToolHelp.GetTextWidth(ColumnTitle, AColumn.Font);
                AColumn.Width := Max(AColumn.Width, TextWidth + BorderSizeX * 2);
                ArrowPosition := BorderSizeX div 2;
              end;
            else
            begin
              Arrow.Visible := False;
              Exit;
            end;
          end;
     
          // Dessine le Triangle
          with TCanvasSLTAssistant.Create(Buffer.Canvas) do
          try
            // Fond opaque avec contour
            BorderRect := Rect(0, 0, BorderSizeX, BorderSizeY);
            Buffer.Canvas.Pen.Color := AColumn.Title.Font.Color;
            Buffer.Canvas.Brush.Color := TCanvasSLTAssistant.GetConstratedColor(AColumn.Title.Font.Color);
            Buffer.Canvas.Rectangle(BorderRect.Left, BorderRect.Top, BorderRect.Right, BorderRect.Bottom);
     
            // Fleche
            ArrowRect := Rect(2, 2, 1 + ArrowSizeX, 1 + ArrowSizeY);
            Buffer.Canvas.Pen.Color := AColumn.Title.Font.Color;
            Buffer.Canvas.Brush.Color := AColumn.Title.Font.Color;
     
            if ASortDirection = csdAscending then
            begin
              P1 := Point(ArrowRect.Left, ArrowRect.Bottom);
              P2 := Point(ArrowRect.Left + ArrowSizeY - 1, ArrowRect.Top);
              P3 := Point(ArrowRect.Right, ArrowRect.Bottom);
            end
            else if ASortDirection = csdDescending then
            begin
              P1 := Point(ArrowRect.Left, ArrowRect.Top);
              P2 := Point(ArrowRect.Left + ArrowSizeY - 1, ArrowRect.Bottom);
              P3 := Point(ArrowRect.Right, ArrowRect.Top);
            end;
     
            Triangle[0] := P1;
            Triangle[1] := P2;
            Triangle[2] := P3;
     
            Canvas.Polygon(Triangle);
          finally
            Free();
          end;
     
          // Dessin final
          Arrow.Image.Picture.Assign(Buffer);
     
          ColumnTopLeft := DBGrid.ScreenToClient(ColumnRect.TopLeft);
          Inc(ColumnTopLeft.X, ArrowPosition);
          Arrow.Left := ColumnTopLeft.X;
          Arrow.Top := ColumnTopLeft.Y + 1;
          Arrow.Visible := True;
          Arrow.BringToFront();
        finally
          Buffer.Free();
        end;
      end
      else
        Arrow.Visible := False;
    end;
     
    //------------------------------------------------------------------------------
    procedure TDBGridSLTAssistant.DrawEllipsisButton(const ARect: TRect; ABackgroundColor: TColor = clNone; AColumn: TColumn = nil; AState: TGridDrawState = []);
    const
      CSelected: array[TGridDrawingStyle] of TThemedGrid = (
        tgClassicCellSelected, tgCellSelected, tgGradientCellSelected);
    var
      Details: TThemedElementDetails;
      StyleColor: TColor;
      Buffer: Vcl.Graphics.TBitmap;
      BufferRect, ButtonRect: TRect;
      BufferWidth, ButtonWidth: Integer;
      W, X, Y: Integer;
    begin
      // j'utilise un Buffer temporaire pour dessiner le ThemedButton sur un fond coloré et ses trois points
      Buffer := Vcl.Graphics.TBitmap.Create();
      try
        ButtonWidth := GetSystemMetrics(SM_CXVSCROLL);
        BufferWidth := ButtonWidth + 2;
        BufferRect := Rect(0, 0, BufferWidth, ARect.Height);
        Buffer.SetSize(BufferRect.Width, BufferRect.Height);
     
        if ABackgroundColor = clNone then
        begin
          // On dessine un fond normal assurant normalement un bon constrate avec le bouton '...'
          Details := StyleServices.GetElementDetails(tgCellNormal);
          if not StyleServices.GetElementColor(Details, ecFillColor, StyleColor) then
            StyleColor := DBGrid.Color; // Si les thèmes ne sont pas activé comme sous CITRIX, ce utilise la couleur de la Grille
        end
        else
          StyleColor := ABackgroundColor;
     
        // Si selectionné, on affiche en fond la mise en évidence de la sélection
        // sinon on force un fond opaque pour cacher le dessin original !
        if (ABackgroundColor = clNone) and (gdSelected in AState) then
        begin
          ButtonRect := BufferRect;
          InflateRect(ButtonRect, 1, 0); // les bordures en dehors du buffer ne seront ainsi pas dessinées (inspiré des tricheries dans TCustomGrid.DrawCellHighlight)
          StyleServices.DrawElement(Buffer.Canvas.Handle, StyleServices.GetElementDetails(CSelected[DBGrid.DrawingStyle]), ButtonRect);
        end
        else
        begin
          Buffer.Canvas.Brush.Color := StyleColor;
          Buffer.Canvas.Brush.Style := bsSolid;
          Buffer.Canvas.FillRect(BufferRect);
        end;
     
        ButtonRect := BufferRect;
        InflateRect(ButtonRect, -1, -1);
     
        if StyleServices.Enabled then
        begin
          Details := StyleServices.GetElementDetails(tgEllipsisButtonNormal);
          StyleServices.DrawElement(Buffer.Canvas.Handle, Details, ButtonRect);
        end
        else
          DrawEdge(Buffer.Canvas.Handle, ButtonRect, EDGE_RAISED, BF_RECT or BF_MIDDLE);
     
        // Dessine les trois points
        // Centrage
        X := BufferRect.Width div 2;
        Y := BufferRect.Height div 2;
        W := ButtonWidth shr 3;
        if W = 0 then
         W := 1;
        // Point central
        PatBlt(Buffer.Canvas.Handle, X, Y, W, W, DSTINVERT);
        // Point de gauche
        PatBlt(Buffer.Canvas.Handle, X - (W * 2), Y, W, W, DSTINVERT);
        // Point de droite
        PatBlt(Buffer.Canvas.Handle, X + (W * 2), Y, W, W, DSTINVERT);
     
        // Dessin final
        if not DBGrid.UseRightToLeftAlignment and (not Assigned(AColumn) or ((AColumn.Alignment <> taRightJustify) and not (AColumn.Field is TNumericField))) then
          DBGrid.Canvas.Draw(ARect.Left + ARect.Width - BufferWidth, ARect.Top, Buffer)
        else
          DBGrid.Canvas.Draw(ARect.Left, ARect.Top, Buffer);
     
      finally
        Buffer.Free();
      end;
    end;
     
    //------------------------------------------------------------------------------
    procedure TDBGridSLTAssistant.DrawTextWithBackgroundColor(ABackgroundColor: TColor; const ARect: TRect; AColumn: TColumn; AState: TGridDrawState);
    var
      vText: string;
      vRect: TRect;
    begin
      with DBGrid.Canvas do
      begin
        //  Force un fond opaque pour cacher le texte !
        Brush.Style := bsSolid;
        Brush.Color := ColorToRGB(ABackgroundColor);
        FillRect(ARect);
     
        // TextRect encapsule DraxTextEx et est aussi pénible avec ses paramètres in-out !
        vRect := ARect;
        if Assigned(AColumn.Field) then
          vText := AColumn.Field.DisplayText;
        Font.Color := TCanvasSLTAssistant.GetConstratedColor(ABackgroundColor); // Couleur de luminosité inverse : Contraste garanti pour les couleurs claires ou foncées
     
        // Gestion de l'Alignment corrigé selon de Vcl.DBGrids.WriteText
        // DT_CENTER Centers text horizontally in the rectangle.
        // DT_VCENTER Centers text vertically. This value is used only with the DT_SINGLELINE value.
        if AColumn.Alignment = taLeftJustify then
          TextRect(vRect, vRect.Left + 3, vRect.Top + 2, vText)
        else if AColumn.Alignment = taCenter then
          TextRect(vRect, vText, [tfCenter, tfSingleLine, tfVerticalCenter])
        else
        begin
          vRect.Right := vRect.Right - 3;
          TextRect(vRect, vText, [tfRight, tfSingleLine, tfVerticalCenter]);
        end;
     
        if (gdRowSelected in AState) or ((dgRowSelect in DBGrid.Options) and (gdSelected in AState)) then
        begin
          // Pour ne pas dessiner les bords de focus entre les colonnes (inspiré des tricheries dans TCustomGrid.DrawCellHighlight)
          vRect := ARect;
          InflateRect(vRect, 1, 0);
          DrawFocusRect(vRect);
        end
        else
          if gdSelected in AState then
            DrawFocusRect(vRect);
      end;
    end;
     
    //------------------------------------------------------------------------------
    function TDBGridSLTAssistant.EditButtonInputDatePicker(const Msg: string; AField: TField): Boolean;
    var
      Value: TDateTime;
    begin
      if not AField.IsNull then
        Value := AField.AsDateTime
      else
        Value := Date();
     
      Result := TSLTMessageDlg.InputDateTime(Msg, Value, idtkDate);
      if Result then
      begin
        // Le AutoEdit ne fait pas effet sur un Ellipsis button !
        if not (AField.DataSet.State in [dsEdit, dsInsert]) then
          AField.DataSet.Edit();
        AField.AsDateTime := Value;
      end;
    end;
     
    //------------------------------------------------------------------------------
    function TDBGridSLTAssistant.GetColRowScreenRect(ACol, ARow: Integer): TRect;
    begin
      Result := TDBGridHack(DBGrid).CellRect(ACol, ARow);
      if not Result.IsEmpty() then
      begin
        // CellRect ne renvoie pas de coordonnées écran malgré ce que dit l'aide !
        Result.TopLeft := DBGrid.ClientToScreen(Result.TopLeft);
        Result.BottomRight := DBGrid.ClientToScreen(Result.BottomRight);
     
        InflateRect(Result, -1, -1);
      end;
    end;
     
    //------------------------------------------------------------------------------
    function TDBGridSLTAssistant.GetColumnScreenRect(const AColumn: TColumn): TRect;
    var
      Col, Row: Integer;
    begin
      Col := AColumn.Index;
      if dgIndicator in DBGrid.Options then
        Inc(Col);
      Row := TDBGridHack(DBGrid).Row;
     
      Result := GetColRowScreenRect(Col, Row);
    end;
     
    //------------------------------------------------------------------------------
    function TDBGridSLTAssistant.GetColumnTitleScreenRect(const AColumn: TColumn): TRect;
    var
      Col, Row: Integer;
    begin
      Col := AColumn.Index;
      if dgIndicator in DBGrid.Options then
        Inc(Col);
      Row := 0; // le Titre !
     
      Result := GetColRowScreenRect(Col, Row);
    end;
     
    //------------------------------------------------------------------------------
    function TDBGridSLTAssistant.GetEllipsisButtonScreenRect(const AColumn: TColumn): TRect;
    var
      ButtonWidth: Integer;
    begin
      Result := GetColumnScreenRect(AColumn);
     
      ButtonWidth := GetSystemMetrics(SM_CXVSCROLL);
      if not DBGrid.UseRightToLeftAlignment and (AColumn.Alignment <> taRightJustify) and not (AColumn.Field is TNumericField) then
        Result.Left := Result.Right - ButtonWidth
      else
        Result.Width := ButtonWidth;
    end;
     
    //------------------------------------------------------------------------------
    function TDBGridSLTAssistant.GetThemedBackgroundColor(): TColor;
    var
      Details: TThemedElementDetails;
    begin
      if StyleServices.Enabled then
      begin
        Details := StyleServices.GetElementDetails(tgCellNormal);
        StyleServices.GetElementColor(Details, ecFillColor, Result);
      end
      else
        Result := clWindow;
    end;
     
    //------------------------------------------------------------------------------
    class function TDBGridSLTAssistant.GetThemeUseColumnColor(): Boolean;
    begin
      // En XE2, cela ne gère pas la propriété Color des TColumns
    {$IF CompilerVersion = CompilerVersionXE2}
      Result := not StyleServices.Enabled or StyleServices.IsSystemStyle;
    {$ELSE}
      raise EAbstractError.Create('TDBGridSLTAssistant.GetThemeUseColumnColor');
    {$IFEND}
    end;
     
    //------------------------------------------------------------------------------
    function TDBGridSLTAssistant.HitOnColumnCell(out AColumn: TColumn): Boolean;
    var
      HitPoint: TPoint;
      HitCoord: TGridCoord;
    begin
      HitPoint := Mouse.CursorPos;
      HitPoint := DBGrid.ScreenToClient(HitPoint);
      HitCoord := DBGrid.MouseCoord(HitPoint.X, HitPoint.Y);
     
      if dgTitles in DBGrid.Options then
        Dec(HitCoord.Y);
     
      Result := (HitCoord.Y >= 0);
     
      if Result then
      begin
        if dgIndicator in DBGrid.Options then
          Dec(HitCoord.X);
     
        AColumn := DBGrid.Columns[HitCoord.X];
      end;
    end;
     
    //------------------------------------------------------------------------------
    function TDBGridSLTAssistant.HitOnEllipsisButton(AColumn: TColumn): Boolean;
    var
      HitPoint: TPoint;
      GridRect, ButtonRect: TRect;
    begin
      Result := False;
     
      if AColumn.ButtonStyle = cbsEllipsis then
      begin
        HitPoint := Mouse.CursorPos;
        GridRect := DBGrid.BoundsRect;
        GridRect.TopLeft := DBGrid.Parent.ClientToScreen(GridRect.TopLeft);
        GridRect.BottomRight := DBGrid.Parent.ClientToScreen(GridRect.BottomRight);
     
        if PtInRect(GridRect, HitPoint) then
        begin
          ButtonRect := GetEllipsisButtonScreenRect(AColumn);
     
          Result := PtInRect(ButtonRect, HitPoint);
        end;
      end;
    end;
     
    //------------------------------------------------------------------------------
    function TDBGridSLTAssistant.HitOnTitle(out AColumn: TColumn): Boolean;
    var
      HitPoint: TPoint;
      HitCoord: TGridCoord;
    begin
      Result := False;
      if dgTitles in DBGrid.Options then
      begin
        HitPoint := Mouse.CursorPos;
        HitPoint := DBGrid.ScreenToClient(HitPoint);
        HitCoord := DBGrid.MouseCoord(HitPoint.X, HitPoint.Y);
        Result := (HitCoord.Y = 0);
        if Result then
        begin
          if dgIndicator in DBGrid.Options then
            Dec(HitCoord.X);
     
          AColumn := DBGrid.Columns[HitCoord.X];
        end;
      end;
    end;
     
    //------------------------------------------------------------------------------
    procedure TDBGridSLTAssistant.ZoomColumnTitleWidth(AZoomPourcent: Integer);
    const
      AUTOSIZE_WIDTH = 64;
    var
      I: Integer;
    begin
      for I := 0 to DBGrid.Columns.Count - 1 do
        with DBGrid.Columns[I] do
          if Width <> AUTOSIZE_WIDTH then
            Width := Round(Width * AZoomPourcent / 100);
    end;
     
    //------------------------------------------------------------------------------
    function TDBGridSLTAssistant.ShowCombo(const Msg: string; APickList: TStrings; var APickListIndex: Integer): Boolean;
    begin
      Result := TSLTMessageDlg.InputCombo(Msg, APickList, APickListIndex);
    end;
     
    end.
    Aide via F1 - FAQ - Guide du développeur Delphi devant un problème - Pensez-y !
    Attention Troll Méchant !
    "Quand un homme a faim, mieux vaut lui apprendre à pêcher que de lui donner un poisson" Confucius
    Mieux vaut se taire et paraître idiot, Que l'ouvrir et de le confirmer !
    L'ignorance n'excuse pas la médiocrité !

    L'expérience, c'est le nom que chacun donne à ses erreurs. (Oscar Wilde)
    Il faut avoir le courage de se tromper et d'apprendre de ses erreurs

  5. #5
    Expert éminent
    Avatar de Lung
    Profil pro
    Analyste-programmeur
    Inscrit en
    Mai 2002
    Messages
    2 663
    Détails du profil
    Informations personnelles :
    Âge : 43
    Localisation : France, Haute Savoie (Rhône Alpes)

    Informations professionnelles :
    Activité : Analyste-programmeur
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2002
    Messages : 2 663
    Points : 6 949
    Points
    6 949
    Par défaut
    Citation Envoyé par ShaiLeTroll Voir le message
    Ma flèche est elle par dessus le Grid et pas dessiné dans le Grid, je n'ai pas donné tout le code
    il y un TArrowImage qui est un TPanel contenant un TImage qui prend le TDBGrid comme Parent
    J'ai testé ton idée de poser un TPanel en enfant par-dessus la DBGrid : j'ai dû rater quelque chose, parce que mon application se fige. J'ai l'impression que la présence du Panel sur la grille lui fait redéclencher OnDrawColumnCell en boucle.

    Le Panel titre :
    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
       TTitreColonne = class(TPanel)
          strict private
             _LabelTitre: TLabel;
     
          public
             property LabelTitre: TLabel read _LabelTitre write _LabelTitre;
     
             constructor Create(AOwner: TComponent; AParent: TWinControl; const Position: TPoint; const Taille: TSize; const szTitre: String);   reintroduce;
             destructor Destroy;   override;
       end;
     
    ...
     
    constructor TTitreColonne.Create(AOwner: TComponent; AParent: TWinControl; const Position: TPoint; const Taille: TSize; const szTitre: String);
    begin
       inherited Create(AOwner);
       Parent := AParent;
       Left := Position.X;
       Top := Position.Y;
       Width := Taille.cx;
       Height := Taille.cy;
       Caption := '';
       BringToFront;
     
       _LabelTitre := TLabel.Create(Self);
       _LabelTitre.Parent := Self;
       _LabelTitre.Align := alClient;
       _LabelTitre.Alignment := taCenter;
       _LabelTitre.Caption := szTitre;
    end;
     
    destructor TTitreColonne.Destroy;
    begin
       _LabelTitre.Free;
     
       inherited;
    end;
    Le tableau de Panel de la DBGrid :
    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
       TTabTitresColonne = Array of TTitreColonne;
     
       TDBGrid = class(DBGrids.TDBGrid)
          strict private
             _TabTitresColonne: TTabTitresColonne;
     
          public
             property TabTitresColonne: TTabTitresColonne read _TabTitresColonne write _TabTitresColonne;
     
             constructor Create(AOwner: TComponent);   override;
             procedure MajColonne(Colonne: TColumn; const ARect: TRect);
             destructor Destroy;   override;
       end;
     
    ...
     
    constructor TDBGrid.Create(AOwner: TComponent);
    begin
      inherited;
       SetLength(_TabTitresColonne, 0);
    end;
     
    procedure TDBGrid.MajColonne(Colonne: TColumn; const ARect: TRect);
    begin
       if Colonne.Index > 0 then                // Pour tester juste le premier champ.
          Exit;
     
       if Colonne.Index > High(_TabTitresColonne) then
       begin
          SetLength(_TabTitresColonne, Colonne.Index + 1);
          _TabTitresColonne[Colonne.Index] := TTitreColonne.Create(Self, Self, Point(ARect.Left, ARect.Top), TSize.Create(ARect.Width, RowHeights[0]), Colonne.FieldName);
       end
       else
       begin
          _TabTitresColonne[Colonne.Index].Left := ARect.Left;
          _TabTitresColonne[Colonne.Index].Top := ARect.Top;
          _TabTitresColonne[Colonne.Index].Width := ARect.Width;
          _TabTitresColonne[Colonne.Index].Height := RowHeights[0];
          _TabTitresColonne[Colonne.Index].LabelTitre.Caption := Colonne.FieldName;
       end;
    end;
     
    destructor TDBGrid.Destroy;
    var
       i: Integer;
    begin
       for i:=Low(_TabTitresColonne) to High(_TabTitresColonne) do
          _TabTitresColonne[i].Free;
       SetLength(_TabTitresColonne, 0);
     
       inherited;
    end;
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    procedure TMainForm.DBGridTablesDrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
    begin
    ...
       DBGridTables.MajColonne(Column, Rect);
    ...
    end;

    L'urgent est fait, l'impossible est en cours, pour les miracles prévoir un délai. ___ Écrivez dans un français correct !!

    C++Builder 5 - Delphi 6#2 Entreprise - Delphi 2007 Entreprise - Delphi 2010 Architecte - Delphi XE Entreprise - Delphi XE7 Entreprise - Delphi 10 Entreprise - Delphi 10.3.2 Entreprise - Delphi 10.4.2 Entreprise
    OpenGL 2.1 - Oracle 10g - Paradox - Interbase (XE) - PostgreSQL (11.6 - 14.6)

  6. #6
    Expert éminent sénior
    Avatar de ShaiLeTroll
    Homme Profil pro
    Développeur C++\Delphi
    Inscrit en
    Juillet 2006
    Messages
    13 429
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Seine Saint Denis (Île de France)

    Informations professionnelles :
    Activité : Développeur C++\Delphi
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juillet 2006
    Messages : 13 429
    Points : 24 794
    Points
    24 794
    Par défaut
    C'est vrai que je n'ai qu'un seul TPanel, celui de la flèche Haut et Bas
    Je n'utilise pas OnDrawColumnCell pour gérer les titres mais seulement les données
    En fait, une fois monté mon TDBGridSliteSortAssistant, il se charge de tout, je n'ai pas de code à ajouter,
    c'est conçu pour être un outil rapide à mettre en place et plus léger que les grilles DevExpress que mon collègue affectionne


    en fait dans mon code d'appel je n'ai que ça
    ShowManquants est appelé dans le constructeur ou dans un bouton Refresh

    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
     
    //------------------------------------------------------------------------------
    procedure TGDVManquantForm.ShowManquants();
    var
      OrderedColumn: TColumn;
    begin
      ... bla bla ... 
     
      if not Assigned(FManquantGridSortAssistant) then
      begin
        FManquantGridSortAssistant := TDBGridThomSortAssistant.Create(DBGridManquants);
        FManquantGridSortAssistant.OnBeforeSort := ManquantGridBeforeSortEventHanler;
        OrderedColumn := nil; // Laisse le tri naturel du DataSet retourné par OpenManquants !
      end
      else
      begin
        FManquantGridSortAssistant.DataSet := nil;
        OrderedColumn := FManquantGridSortAssistant.ColumnOrdered;
      end;
     
      ... bla bla ... 
     
        FManquantGridSortAssistant.DataSet := GDVManquantDataModule.OpenManquants(FMode);
        FManquantGridSortAssistant.ColumnOrdered := OrderedColumn;
     
     
    end;
    Aide via F1 - FAQ - Guide du développeur Delphi devant un problème - Pensez-y !
    Attention Troll Méchant !
    "Quand un homme a faim, mieux vaut lui apprendre à pêcher que de lui donner un poisson" Confucius
    Mieux vaut se taire et paraître idiot, Que l'ouvrir et de le confirmer !
    L'ignorance n'excuse pas la médiocrité !

    L'expérience, c'est le nom que chacun donne à ses erreurs. (Oscar Wilde)
    Il faut avoir le courage de se tromper et d'apprendre de ses erreurs

  7. #7
    Expert confirmé
    Avatar de anapurna
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Mai 2002
    Messages
    3 410
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Mai 2002
    Messages : 3 410
    Points : 5 801
    Points
    5 801
    Par défaut
    salut la compagnie

    dites moi c'est pas plus simple de modifier la propriété color de Title sur chaque TColumn
    ou plus simplement la propriete FixedColor du DBGrid
    moi je dis ça je dis rien

    je peux pas essayer mais je pense que le DBGRID n'as pas tans changé que cela
    Nous souhaitons la vérité et nous trouvons qu'incertitude. [...]
    Nous sommes incapables de ne pas souhaiter la vérité et le bonheur, et sommes incapables ni de certitude ni de bonheur.
    Blaise Pascal
    PS : n'oubliez pas le tag

  8. #8
    Expert éminent
    Avatar de Lung
    Profil pro
    Analyste-programmeur
    Inscrit en
    Mai 2002
    Messages
    2 663
    Détails du profil
    Informations personnelles :
    Âge : 43
    Localisation : France, Haute Savoie (Rhône Alpes)

    Informations professionnelles :
    Activité : Analyste-programmeur
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2002
    Messages : 2 663
    Points : 6 949
    Points
    6 949
    Par défaut
    Citation Envoyé par anapurna Voir le message
    dites moi c'est pas plus simple de modifier la propriété color de Title sur chaque TColumn
    Je ne connaissais pas. J'ai testé, mais hélas, ça change la couleur de fond de toutes les cellules de la colonne sauf celle de l'en-tête (c'est exactement l'inverse que je recherche).

    Citation Envoyé par anapurna Voir le message
    ou plus simplement la propriete FixedColor du DBGrid
    Cette propriété s'applique sur toutes les en-tête sans distinction.
    Moi, c'est seulement certaines en-tête de colonne, selon un critère dépendant de la table affichée.
    L'urgent est fait, l'impossible est en cours, pour les miracles prévoir un délai. ___ Écrivez dans un français correct !!

    C++Builder 5 - Delphi 6#2 Entreprise - Delphi 2007 Entreprise - Delphi 2010 Architecte - Delphi XE Entreprise - Delphi XE7 Entreprise - Delphi 10 Entreprise - Delphi 10.3.2 Entreprise - Delphi 10.4.2 Entreprise
    OpenGL 2.1 - Oracle 10g - Paradox - Interbase (XE) - PostgreSQL (11.6 - 14.6)

  9. #9
    Expert confirmé
    Avatar de anapurna
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Mai 2002
    Messages
    3 410
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Mai 2002
    Messages : 3 410
    Points : 5 801
    Points
    5 801
    Par défaut
    salut

    on parle bien de modifier l'entete d'un DBGRID
    sous les ancienne version de delphi cela marche a merveille je suis surpris que cela fonctionne a l'inverse maintenant

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
      MONBGRID.Columns[2].Title.Color := ClRed;
    Nous souhaitons la vérité et nous trouvons qu'incertitude. [...]
    Nous sommes incapables de ne pas souhaiter la vérité et le bonheur, et sommes incapables ni de certitude ni de bonheur.
    Blaise Pascal
    PS : n'oubliez pas le tag

  10. #10
    Expert éminent
    Avatar de Lung
    Profil pro
    Analyste-programmeur
    Inscrit en
    Mai 2002
    Messages
    2 663
    Détails du profil
    Informations personnelles :
    Âge : 43
    Localisation : France, Haute Savoie (Rhône Alpes)

    Informations professionnelles :
    Activité : Analyste-programmeur
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2002
    Messages : 2 663
    Points : 6 949
    Points
    6 949
    Par défaut
    Bon, le moins pire semble être la bidouille qui consiste à dessiner avec le Canvas.Pen après l'appel à DefaultDrawColumnCell.
    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
       procedure AffFondTitre(const Couleur: TColor);
       var
          i: Integer;
       begin
          DBGridTables.Canvas.Pen.Color := Couleur;
          for i:=0 to Pred(TDBGridEx(DBGridTables).RowHeights[0]) do
          begin
             DBGridTables.Canvas.MoveTo(Rect.Left, i);
             DBGridTables.Canvas.LineTo(Rect.Right, i);
          end;
     
          DBGridTables.Canvas.Brush.Color := Couleur;
          DBGridTables.Canvas.Font.Color := clBlack;
          DBGridTables.Canvas.TextOut(Rect.Left + 2, 2, Column.FieldName);
       end;
     
    procedure TMainForm.DBGridTablesDrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
    begin
       ...
       Column.Grid.DefaultDrawColumnCell(Rect, DataCol, Column, State);
     
       if ... then
          AffFondTitre($00E9DCE1);
    end;
    Et pour essayer d'éviter que ce soit effacé au survol de la souris :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    procedure TMainForm.DBGridTablesMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
    begin
       DBGridTables.Repaint;
    end;
     
    procedure TMainForm.DBGridTablesMouseLeave(Sender: TObject);
    begin
       DBGridTables.Repaint;
    end;
    L'urgent est fait, l'impossible est en cours, pour les miracles prévoir un délai. ___ Écrivez dans un français correct !!

    C++Builder 5 - Delphi 6#2 Entreprise - Delphi 2007 Entreprise - Delphi 2010 Architecte - Delphi XE Entreprise - Delphi XE7 Entreprise - Delphi 10 Entreprise - Delphi 10.3.2 Entreprise - Delphi 10.4.2 Entreprise
    OpenGL 2.1 - Oracle 10g - Paradox - Interbase (XE) - PostgreSQL (11.6 - 14.6)

  11. #11
    Expert éminent sénior
    Avatar de ShaiLeTroll
    Homme Profil pro
    Développeur C++\Delphi
    Inscrit en
    Juillet 2006
    Messages
    13 429
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Seine Saint Denis (Île de France)

    Informations professionnelles :
    Activité : Développeur C++\Delphi
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juillet 2006
    Messages : 13 429
    Points : 24 794
    Points
    24 794
    Par défaut
    Citation Envoyé par anapurna Voir le message
    salut

    on parle bien de modifier l'entete d'un DBGRID
    sous les ancienne version de delphi cela marche a merveille je suis surpris que cela fonctionne a l'inverse maintenant

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
      MONBGRID.Columns[2].Title.Color := ClRed;
    Depuis les thèmes, beaucoup de chose comme cela ne fonctionne plus
    Sous XE2, lancer sur un Windows en thème 98 même là ça ne fait absolument rien
    Pas mieux avec un programme sans aucun manifest

    Même en DrawingStyle gdsClassic, cela ne gère QUE le FixedColor
    Aide via F1 - FAQ - Guide du développeur Delphi devant un problème - Pensez-y !
    Attention Troll Méchant !
    "Quand un homme a faim, mieux vaut lui apprendre à pêcher que de lui donner un poisson" Confucius
    Mieux vaut se taire et paraître idiot, Que l'ouvrir et de le confirmer !
    L'ignorance n'excuse pas la médiocrité !

    L'expérience, c'est le nom que chacun donne à ses erreurs. (Oscar Wilde)
    Il faut avoir le courage de se tromper et d'apprendre de ses erreurs

  12. #12
    Rédacteur/Modérateur

    Avatar de SergioMaster
    Homme Profil pro
    Développeur informatique retraité
    Inscrit en
    Janvier 2007
    Messages
    15 021
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 67
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur informatique retraité
    Secteur : Industrie

    Informations forums :
    Inscription : Janvier 2007
    Messages : 15 021
    Points : 40 934
    Points
    40 934
    Billets dans le blog
    62
    Par défaut
    Bonjour,
    Citation Envoyé par anapurna Voir le message
    sous les ancienne version de delphi cela marche a merveille je suis surpris que cela fonctionne a l'inverse maintenant
    Cela fonctionne toujours si la propriété DrawingStyle est gdsClassic.

    Nom : Capture.PNG
Affichages : 1163
Taille : 2,7 Ko
    Après, comme sur l'image, je me suis "amusé" à faire des petits trucs
    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
    type
      TMyGrid = Class(TCustomGrid);
     
      TForm11 = class(TForm)
        DBGrid1: TDBGrid;
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Déclarations privées }
      public
        { Déclarations publiques }
      end;
     
    var
      Form11: TForm11;
     
    implementation
     
    {$R *.dfm}
     
    procedure TForm11.Button1Click(Sender: TObject);
    Var ARect : TRect;
        Grid : TMyGrid;
    begin
     Grid:=TMyGrid(DBGrid1);
     With Grid do
      begin
        ARect:=TRect.Empty;
        ARect.Top:=1;
        ARect.Left:=1;
        ARect.Width:=120;
        ARect.Height:=110;
        DrawCellBackground(ARect,clRed,[],0,1);
      end;
    end;
    en désactivant les options dgTitleClick et dgTitleHotTrack j'ai bien mon rectangle rouge qui ne bouge pas
    de même dés que j'utilise l'éditeur (clic sur une cellule) mon rouge se barre
    Maintenant, j'ai fait le bourrin pour ce qui est du rectangle rouge, mon Rectangle est "à l'arrache" juste pour tester
    MVP Embarcadero
    Delphi installés : D3,D7,D2010,XE4,XE7,D10 (Rio, Sidney), D11 (Alexandria), D12 (Athènes)
    SGBD : Firebird 2.5, 3, SQLite
    générateurs États : FastReport, Rave, QuickReport
    OS : Window Vista, Windows 10, Windows 11, Ubuntu, Androïd

  13. #13
    Expert éminent
    Avatar de Lung
    Profil pro
    Analyste-programmeur
    Inscrit en
    Mai 2002
    Messages
    2 663
    Détails du profil
    Informations personnelles :
    Âge : 43
    Localisation : France, Haute Savoie (Rhône Alpes)

    Informations professionnelles :
    Activité : Analyste-programmeur
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2002
    Messages : 2 663
    Points : 6 949
    Points
    6 949
    Par défaut
    Citation Envoyé par SergioMaster Voir le message
    en désactivant les options dgTitleClick et dgTitleHotTrack j'ai bien mon rectangle rouge qui ne bouge pas
    Comme j'ai besoin du dgTitleClick, je suis coincé.
    Je vais devoir rester avec ma bidouille ...
    L'urgent est fait, l'impossible est en cours, pour les miracles prévoir un délai. ___ Écrivez dans un français correct !!

    C++Builder 5 - Delphi 6#2 Entreprise - Delphi 2007 Entreprise - Delphi 2010 Architecte - Delphi XE Entreprise - Delphi XE7 Entreprise - Delphi 10 Entreprise - Delphi 10.3.2 Entreprise - Delphi 10.4.2 Entreprise
    OpenGL 2.1 - Oracle 10g - Paradox - Interbase (XE) - PostgreSQL (11.6 - 14.6)

  14. #14
    Rédacteur/Modérateur

    Avatar de SergioMaster
    Homme Profil pro
    Développeur informatique retraité
    Inscrit en
    Janvier 2007
    Messages
    15 021
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 67
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur informatique retraité
    Secteur : Industrie

    Informations forums :
    Inscription : Janvier 2007
    Messages : 15 021
    Points : 40 934
    Points
    40 934
    Billets dans le blog
    62
    Par défaut
    Citation Envoyé par Lung Voir le message
    Comme j'ai besoin du dgTitleClick, je suis coincé.
    Attention, si c'est juste la couleur de la cellule titre, pas besoin de désactiver dgTitleClick,
    c'est juste si dans cette cellule il y a dessin (par exemple un triangle pour indiquer l'ordre de tri) que ça coince
    Sans rien faire (juste en changeant en gdsClassic)
    Nom : Capture.PNG
Affichages : 1366
Taille : 17,6 Ko
    ici j'ai cliqué sur Prix

    par contre, je me demande si avec un stringgrid et les livebindings ... je vais faire un essai
    MVP Embarcadero
    Delphi installés : D3,D7,D2010,XE4,XE7,D10 (Rio, Sidney), D11 (Alexandria), D12 (Athènes)
    SGBD : Firebird 2.5, 3, SQLite
    générateurs États : FastReport, Rave, QuickReport
    OS : Window Vista, Windows 10, Windows 11, Ubuntu, Androïd

  15. #15
    Expert confirmé
    Avatar de anapurna
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Mai 2002
    Messages
    3 410
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Mai 2002
    Messages : 3 410
    Points : 5 801
    Points
    5 801
    Par défaut
    salut

    sinon tu as cette solution
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
     
    procedure TMyDBGrid.DrawCellBackground(const ARect: TRect; AColor: TColor; AState: TGridDrawState; ACol, ARow: integer);
    begin
      if (FLastSortedColumnIdx = ACol) and (ACol >= 0) and (ARow = -1) then
        AColor := Columns[ACol].Title.Color;
     
      inherited;
    end;
    Nous souhaitons la vérité et nous trouvons qu'incertitude. [...]
    Nous sommes incapables de ne pas souhaiter la vérité et le bonheur, et sommes incapables ni de certitude ni de bonheur.
    Blaise Pascal
    PS : n'oubliez pas le tag

  16. #16
    Rédacteur/Modérateur

    Avatar de SergioMaster
    Homme Profil pro
    Développeur informatique retraité
    Inscrit en
    Janvier 2007
    Messages
    15 021
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 67
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur informatique retraité
    Secteur : Industrie

    Informations forums :
    Inscription : Janvier 2007
    Messages : 15 021
    Points : 40 934
    Points
    40 934
    Billets dans le blog
    62
    Par défaut
    Re,
    Après essai, avec un livebindings pas de soucis puisqu'il s'agit d'un stringgrid
    et ça fonctionne avec les thèmes !
    Nom : Capture.PNG
Affichages : 1358
Taille : 17,4 Ko
    perfection-nable mais comme c'est juste des tests ....
    le plus dur sera de gérer un indicateur comme pour le DBGrid colonne de gauche
    MVP Embarcadero
    Delphi installés : D3,D7,D2010,XE4,XE7,D10 (Rio, Sidney), D11 (Alexandria), D12 (Athènes)
    SGBD : Firebird 2.5, 3, SQLite
    générateurs États : FastReport, Rave, QuickReport
    OS : Window Vista, Windows 10, Windows 11, Ubuntu, Androïd

Discussions similaires

  1. [Python 2.X] Avec openpyxl comment peut-on modifier la couleur de fond d'une cellule précise
    Par nicolas2333 dans le forum Général Python
    Réponses: 1
    Dernier message: 16/05/2017, 17h01
  2. Réponses: 2
    Dernier message: 22/10/2013, 17h57
  3. [OpenOffice] [Présentation] Comment modifier la couleur de fond des commentaires
    Par polymorphisme dans le forum OpenOffice & LibreOffice
    Réponses: 4
    Dernier message: 15/11/2012, 12h20
  4. Réponses: 0
    Dernier message: 05/01/2011, 16h16
  5. c# Comment modifier la couleur de fond d'une statusBar
    Par padodanle51 dans le forum Windows Forms
    Réponses: 1
    Dernier message: 06/03/2006, 18h36

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