sDBGrid selected row color

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #68163
    Support
    Keymaster

      Hello
      You can use in the OnGetCellParams event something like this:

      uses sConst;
      
      procedure TForm1.DBGrid1GetCellParams(Sender: TObject; Field: TField; AFont: TFont; var Background: TColor; State: TGridDrawState; StateEx: TGridDrawStateEx);
      var
        TmpCol: TsColor;
      begin
        if geHighlight in StateEx then begin
          TmpCol.C := DBGrid1.Color;
          TmpCol.R := 255 - TmpCol.R;
          TmpCol.G := 255 - TmpCol.G;
          TmpCol.B := 255 - TmpCol.B;
          Background := TmpCol.C;
      
          TmpCol.C := DBGrid1.Font.Color;
          TmpCol.R := 255 - TmpCol.R;
          TmpCol.G := 255 - TmpCol.G;
          TmpCol.B := 255 - TmpCol.B;
          AFont.Color := TmpCol.C;
        end
      end
      
      #68190
      chemirikmohamed
      Participant

        It works well but was not obvious with the use of different skins, I would like to the selection to have bright colors especially I use in GetCellParam slEditGreen, slEditGreenText, slEditRed, slEditRedText, slEditYellow, slEditYellowText

        #68191
        chemirikmohamed
        Participant

          Thank you very much it works well, it was just necessary to put the code that you gave me after the colors proposed in GetCellParam.

        Viewing 3 posts - 1 through 3 (of 3 total)
        • The topic ‘sDBGrid selected row color’ is closed to new replies.