//---------------------------------------------------------------------------
void __fastcall
TForm1::ComboBox2DrawItem(TWinControl *Control,
int
Index, TRect &Rect, TOwnerDrawState State)
{
//
eliminate artifacts
ComboBox2->Canvas->FillRect(Rect);
//
make the selection rectangle red for example
if
(State.Contains(odSelected))
{
ComboBox2->Canvas->Brush->Color = clRed;
ComboBox2->Canvas->FillRect(Rect);
}
else
ComboBox2->Canvas->Brush->Color = clHighlight;
// render the text
ComboBox2->Canvas->TextOut(Rect.Left,
Rect.Top,
ComboBox2->Items->Strings[Index]);
}
|