#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2015
    Posts
    6
    Rep Power
    0

    ListBoxItem Background


    Hallo everyone!
    I am trying to change the background color at runtime of an instance of TListboxItem (the first Item of the ListBox in my case).
    I have tried with the following code:
    Code:
       Var
         ListBox : TListBox;
         PIndex : Integer;
       Begin
          PIndex := 0;
         
          ListBox.ListItems[PIndex].Canvas.BeginScene;
          ListBox.ListItems[PIndex].Canvas.Fill.Color := TAlphaColorRec.Red;
          ListBox.ListItems[PIndex].Repaint;
          ListBox.ListItems[PIndex].Canvas.EndScene;
        End;
    My code doesn't give me the required results. Can someone maybe help me to change the background of a listboxitem at runtime.
    Thanks in advance!
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2015
    Posts
    6
    Rep Power
    0
    Just something I forgot to say: I am using Firemonkey.

IMN logo majestic logo threadwatch logo seochat tools logo