Board index » delphi » DBGrid Selectedrows
|
Claude Lec
Delphi Developer |
|
Claude Lec
Delphi Developer |
DBGrid Selectedrows2006-05-31 04:57:47 PM delphi115 Hi I want to thave he selected row in a DBgrid in color. I try to work with selectedrows but couldn't achieve what I wanted. To have the selectedrows highlighted in some way. Someone has an idee? thanks regards to all claude |
| Marco Maes
Delphi Developer |
2006-05-31 08:10:11 PM
Re:DBGrid Selectedrows
Hello Claude,
You can use the OnDrawDataCell on the TDBGrid component. You can use something like this for example: procedure TForm1.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect; Field: TField; State: TGridDrawState); begin if DBGrid1.SelectedRows.CurrentRowSelected then begin DBGrid1.Canvas.Font.Color := clRed; // Font color DBGrid1.Canvas.Brush.Color := clLime; // Background color DBGrid1.Canvas.FillRect(Rect); end; DBGrid1.DefaultDrawDataCell(Rect, Field, State); end; Good Luck Marco Maes "Claude Lec" <XXXX@XXXXX.COM>schreef in bericht QuoteHi |
| Claude Lec
Delphi Developer |
2006-05-31 08:14:06 PM
Re:DBGrid Selectedrows
Thanks Marco
I have a try claude "Marco Maes" <XXXX@XXXXX.COM>a écrit dans le message de news: 447d87a6$XXXX@XXXXX.COM... QuoteHello Claude, |
| Billows
Delphi Developer |
2006-05-31 11:38:50 PM
Re:DBGrid Selectedrows
You can set the "Options"->"dgMultiSelect" True!
|
| Inés Fernández
Delphi Developer |
2006-09-19 05:42:43 PM
Re:DBGrid Selectedrows
Hi all!
I have to do some stuff in the OnDrawColumnCell depending on the Selected state of the row. How can I know if a row is selected without making it the current row? T.I.A. Ines |
| DreamChaser
Delphi Developer |
2007-03-03 12:31:56 PM
Re:DBGrid Selectedrows
Inés Fernández writes:
QuoteHi all! } DC |
