Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8742341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:29:01+00:00 2026-06-13T11:29:01+00:00

I am overriding OnDrawCell for a string grid. In certain circumstance, I want to

  • 0

I am overriding OnDrawCell for a string grid. In certain circumstance, I want to use the normal TColor that is used for the selected row when the system does the drawing (no OnDrawCell).

Which colo(u)r is that? clXXX ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:29:02+00:00Added an answer on June 13, 2026 at 11:29 am

    Before of Delphi 2010 you can use the clHighlight color.

    In Delphi 2010 the TStringGrid, TDrawGrid and TDBGrid components now have a DrawingStyle property and depending of this value (gdsClassic, gdsGradient, gdsThemed) you must calculate the color on this way.

    1.for gdsClassic use clHighlight;

    2.for gdsGradient use the GradientFillCanvas method

    GradientFillCanvas(Canvas, GetShadowColor(clHighlight, 45), GetShadowColor(clHighlight, 10), LRect, gdVertical);
    

    3.for gdsThemed call the DrawElement method of the TCustomStyleServices

    StyleServices.DrawElement(Canvas.Handle, StyleServices.GetElementDetails(tgCellSelected), LRect, ARect);
    

    In Delphi XE2 (and XE3) with the introduction of the vcl styles you must use the same of the above but checking if the current style is a “custom style” (vcl style)

    1.for gdsGradient use the GradientFillCanvas method calculating the colors of the gradient on this way

    StyleServices.GetElementColor(StyleServices.GetElementDetails(tgGradientCellRowSelectedRight), ecGradientColor1, StartColor); //StartColor is a TColor variable
    StyleServices.GetElementColor(StyleServices.GetElementDetails(tgGradientCellRowSelectedRight), ecGradientColor2, EndColor);//EndColor is a TColor variable
    

    2.for gdsClassic

    StyleServices.GetElementColor(StyleServices.GetElementDetails(tgClassicCellRowSelectedRight), ecFillColor, LColor); //LColor is a TColor variable
    

    If you want check a sample of how the VCL draw a selected (highlighted) cell/row try the implementation of the TCustomGrid.DrawCellHighlight method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When overriding drawRect I've found that the coordinates there use 0,0 as the upper
Normal overriding would work this way: class Fruit { public: string color(); }; string
I am overriding the clean() method on a Django form. I want to have
I'm having trouble overriding the Code Signing Identity and provisioning profile that are specified
This question demonstrates that overriding an Ember.View instance's didInsertElement allows you to execute some
I am overriding a TreeView so that I can highlight the nodes using better
How to avoid overriding? public partial class test : System.Web.UI.Page { StringBuilder sb =
When overriding a non-virtual method in Java, use of the @Override annotation is recommended,
I'm overriding ASP.NET MVC's Controller.HandleUnknownAction(string actionName) method. It's being called when an action is
When overriding an OnPaint or OnPaintBackground method in an inheritor of System.Windows.Forms.Control, one argument

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.