Hola,gracias tu ejemplo me ayudado pinta la fila ingresado texto en Edit1 pero cuando ingreso otro texto la fila que estaba pintada pierde el color.lo que necesito es a medida que voy ingresando (va comparando con la fila con la caja de texto) quede pintada la filas encontradas.como podria hacer esa parte.gracias.
imagen gif:
gifyu.com/images/GIF78a8c.gif
Código Delphi
[-]var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key = vk_return then
ListView1.Repaint;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
i: integer;
col: tlistcolumn;
Item: TListItem;
begin
ListView1.ViewStyle := TViewStyle.vsReport;
for i := 1 to 2 do
begin
col := ListView1.Columns.Add;
col.Caption := 'column' + i.ToString;
col.Width := 150;
end;
for i := 1 to 10 do
begin
Item := ListView1.items.Add;
Item.Caption := 'n' + i.ToString;
Item.SubItems.Add('item' + i.ToString);
end;
end;
procedure TForm1.ListView1AdvancedCustomDrawItem(Sender: TCustomListView;
Item: TListItem; State: TCustomDrawState; Stage: TCustomDrawStage;
var DefaultDraw: Boolean);
begin
if Edit1.Text = Item.SubItems[0] then
Sender.Canvas.Brush.Color := clred;
end;