Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Tabbed List Box Colors

Posted on 2002-05-15
1
Medium Priority
?
182 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 800 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

636 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