Solved

Default color change for the selected row

Posted on 2000-05-01
5
181 Views
Last Modified: 2010-04-04
How can I change the default color for the selected row (default is blue) in a TDbGrid control ?
0
Comment
Question by:drnadeem
  • 3
  • 2
5 Comments
 
LVL 2

Expert Comment

by:mullet_attack
ID: 2768181
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
 
LVL 1

Author Comment

by:drnadeem
ID: 2768475
This question has a deletion request Pending
0
 
LVL 2

Expert Comment

by:mullet_attack
ID: 2768699
This question no longer is pending deletion
0
 
LVL 2

Accepted Solution

by:
mullet_attack earned 20 total points
ID: 2768700
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
 
LVL 1

Author Comment

by:drnadeem
ID: 2944362
Answer accepted
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video discusses moving either the default database or any database to a new volume.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now