Solved

Default color change for the selected row

Posted on 2000-05-01
5
193 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi Mdi application Child forms get behind control 7 353
update joined tables 2 71
Delphi: barcode reading on android platform 1 98
Firemonkey Tcameracomponent resultion 1 43
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

739 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