Solved

Tabbed List Box Colors

Posted on 2002-05-15
1
179 Views
Last Modified: 2010-04-04
I have a program that I use Tabbed List Boxes in.
What I would like to do is to get different items in one box to have multiple colors / fonts.

How can I get this to work?

0
Comment
Question by:accurates
[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
1 Comment
 
LVL 17

Accepted Solution

by:
inthe earned 200 total points
ID: 7012703
i dont know ,im guessing this is like normal listbox so just set style to ownerdraw and add some code:

procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;
  Rect: TRect; State: TOwnerDrawState);
var
 i : integer;
begin
  if Odd(Index) then
     i := clRed
  else
     i := clYellow;
  TListBox(Control).Canvas.Brush.Color := i;
  if NOT Odd(Index) then
     i := clRed
  else
     i := clYellow;
  TListBox(Control).Canvas.Font.Color := i;
  TListBox(Control).Canvas.TextRect(Rect, Rect.Left, Rect.Top,
     ListBox1.Items.Strings[Index]);
end;

basically if the component has ownderdraw style then you have access to all canvas and fonts brushes/pens colors styles etc..
0

Featured Post

Technology Partners: 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

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

733 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