Solved

Setting colours on the fly

Posted on 2004-04-06
2
161 Views
Last Modified: 2010-04-05

I have a custom control grid with various records in it, depending on certain values the row attributes, such as BG colour, font colour etc are changed.

This works fine by using the draw events of the control

ie

AFont.Color := clRed;

However I want to enable the users to set these colours themselves, so I have another table with values like this

$CC0099
$CCFFCC
....

The I try to set the colour in the same draw event like this:

AFont.Color := TColor(QueryColourSel.AsString);

but this doesn't work, the reason I'm not storing cl colour values in the table is because I want additional colours that are not standard.

Any suggestions on why this doesn't work, no errors are produced, but the colour doesn't change.

Thanks
0
Comment
Question by:dealclickcouk
2 Comments
 
LVL 17

Accepted Solution

by:
mokule earned 125 total points
ID: 10765256
It should work
  AFont.Color := TColor(StrToInt(QueryColourSel.AsString));
0
 

Author Comment

by:dealclickcouk
ID: 10765424

god I'm so stupid, why didn't I think of that!!

thanks for the quick response...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

863 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

20 Experts available now in Live!

Get 1:1 Help Now