[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 213
  • 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

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

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