Is it possible to display items in different colors?
This image is an example of what I need to do.
Is it possible to display items in different colors?
This image is an example of what I need to do.
To do this, you would need to perform custom drawing in the left & right list.
You can attach a custom drawing event handler for the lists with:
AdvDualListBox.LeftList.OnDrawItem
AdvDualListBox.RightList.OnDrawItem
These are two TListBox instances, so custom drawing code for listboxes can be used.
Thank you.
Do you have an example to send me?
I tried with the code below but the event is not executed:
Procedure Form1.FormShow(Sender: TObject)
Begin
:
AdvDualListBox1.LeftList.OnDrawItem:=XYZ;
:
End;
procedure Form1.XYZ(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);
begin
with (Control as TListBox).Canvas do
begin
Brush.Color := clWhite;
FillRect(Rect);
Font.Color:=clRed;
TextOut(Rect.Left, Rect.Top, (Control as TListBox).Items[Index]);
end;
end;
You need to set listbox.Style := lbsOwnerDraw
Thank you