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

  • Home
  • SEARCH
  • 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 7569585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:12:11+00:00 2026-05-30T15:12:11+00:00

I know that i can set custom colors to items when i add them

  • 0

I know that i can set custom colors to items when i add them to the list using OnDraw Events but i want to change colors of the items at a certain point after they are already in the list.

Is there a way to do this ?

  • 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-05-30T15:12:12+00:00Added an answer on May 30, 2026 at 3:12 pm

    To redraw only certain items use the UpdateItems method. It has two input parameters where you can specify the range of the items to be redrawn. If you are going to redraw only one item, then just specify that one item index as a range.

    In this example I’m storing the color of the item into the TListItem.Data property and fading this color in the timer’s event. After changing the value I call the UpdateItems function which force the draw item event to fire. And yes, without DoubleBuffered set, it flickers (even when you set the timer’s interval e.g. to 500ms).

    procedure TForm1.FormCreate(Sender: TObject);
    begin
      ListView1.AddItem('Item 1', TObject(clWhite));
      ListView1.AddItem('Item 2', TObject(clWhite));
      ListView1.AddItem('Item 3', TObject(clWhite));
      Timer1.Enabled := True;
    end;
    
    procedure TForm1.ListView1CustomDrawItem(Sender: TCustomListView;
      Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
    begin
      ListView1.Canvas.Brush.Color := TColor(Item.Data);
    end;
    
    procedure TForm1.Timer1Timer(Sender: TObject);
    var
      C: Byte;
      I: TColor;
    
      procedure ChangeItemColor;
      begin
        I := TColor(ListView1.Items[0].Data);
        C := GetRValue(I);
        if C < 150 then C := 255 else Dec(C);
        I := RGB(C, C, C);
        ListView1.Items[0].Data := TObject(I);
      end;
    
    begin
      // color change
      ChangeItemColor;
      // repaint of the item with index 1
      ListView1.UpdateItems(1, 1);
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that you can set the print margin in Eclipse, but if I
I know that I can set expiration date for a cookie, but can I
I know that I can share files using Shared Folders in Virtual PC, but
So I know that you can set a custom default action in Zend Framework
How can I set a custom Host header in HttpWebRequest? I know that normally
I know that it's a subject that can raise a lot of debate, but
I know that JTable can sort by a single column. But is it possible
I know that I can insert multiple rows using a single statement, if I
I'm trying to create a custom set of classes that can be added to
I know that you can use keywords with labels, but is there any way

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.