[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 212
  • Last Modified:

Default color change for the selected row

How can I change the default color for the selected row (default is blue) in a TDbGrid control ?
0
drnadeem
Asked:
drnadeem
  • 3
  • 2
1 Solution
 
mullet_attackCommented:
In TCustomDBGrid.DrawCell, this bit of code makes the selected cell's colors conform to the settings in Windows :

        if Highlight then
        begin
          Brush.Color := clHighlight;
          Font.Color := clHighlightText;
        end;

so, if you want to use other colors, set DefaultDrawing to false, and write your own routine in the OnDrawColumnCell event. You will have to consider selected or not, fonts, alignment and focus rectangle when you 'draw' the cell yourself.
0
 
drnadeemAuthor Commented:
This question has a deletion request Pending
0
 
mullet_attackCommented:
This question no longer is pending deletion
0
 
mullet_attackCommented:
This appears to be an answer...

so, if you want to use other colors, set DefaultDrawing to false, and write your own routine in the OnDrawColumnCell event. You will have to consider selected or not, fonts, alignment and focus rectangle when you 'draw' the cell yourself.

0
 
drnadeemAuthor Commented:
Answer accepted
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now