Hi
please help and guide me
i have a combobox and write this code and that worked correctly:
procedure TmElements.c205DrawItem(Control: TWinControl;Index: Integer;
ARect: TRect;State: TOwnerDrawState);
var
sText: string;
begin
with (Control as TComboBox).Canvas do begin
case Index of
0 :Font.Color := clDefault;
else begin
Brush.Color:= StringToColor(stgElement.cells[2,index]);
if(Index = 11)then
Font.Color := StringToColor('0');
end;
end;
FillRect(ARect);
TextRect(ARect, 5, ARect.Top, (Control as TComboBox).Items[Index]);
end;
end;
now
in run time i create a new combobox , how can I change DrawItem of new combobox
i use this code but didn't work?
.
.
.
tmpComBo := TComboBox.Create(mElements);
with(tmpComBo)do begin
.
.
.
OnDrawItem := c205.OnDrawItem;
.
.
.