sDBGrid selected row color Root › Discussions › AlphaControls This topic has 3 replies, 2 voices, and was last updated 5 years ago by chemirikmohamed. Viewing 4 posts - 1 through 4 (of 4 total) Author Posts November 20, 2019 at 11:01 am #68159 chemirikmohamedParticipant hi everyone, i would like to know how to change the color of a selected row, reverse the color of the line select. thank you November 21, 2019 at 9:01 am #68163 SupportKeymaster 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 November 23, 2019 at 11:00 pm #68190 chemirikmohamedParticipant 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 November 23, 2019 at 11:11 pm #68191 chemirikmohamedParticipant 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. Author Posts Viewing 4 posts - 1 through 4 (of 4 total) The topic ‘sDBGrid selected row color’ is closed to new replies. Root › Discussions › AlphaControls