KOL + ListView + kolorowanie wierszy

0

Witam...
czy ktoś z was używał już kiedyś pakiet KOL i Lazarus.
Mam pytanie about ListView ;)

Mam program na Pocket PC, w ktorym chcialbym w liście wyróżnić wiersze spełniajace warunek, że jakaś tam kolunma ma wartość 0. Absolutnie nie mam pojęcia jak tego dokonać...

bardzo proszę Was o pomoc

z góry dziękuję za pomocne odpowiedzi

0

znalazłem rozwiązanie

function TForm1.ListView1LVCustomDraw(Sender: PControl; DC: HDC;
Stage: Cardinal; ItemIdx, SubItemIdx: Integer; const Rect: TRect;
ItemState: TDrawState; var TextColor, BackColor: Integer): Cardinal;
var Txt: String;
R, R1: TRect;

procedure ProvideColors;
begin
  if odsSelected in ItemState then
  begin
    if Sender.Focused then
    begin
      Sender.Canvas.Brush.Color := clNavy;
      Sender.Canvas.Font.Color := clYellow;
    end
      else
    begin
      Sender.Canvas.Brush.Color := Color2RGB( clBtnFace );
      Sender.Canvas.Font.Color := clRed;
    end;
  end
    else
  begin
    Sender.Canvas.Brush.Color := clWindow;
    Sender.Canvas.Font.Color := clBlue;
  end;
  Sender.Canvas.DeselectHandles;
end;

var i, j: Integer;
begin
if LongBool(Stage = (CDDS_PREPAINT or CDDS_SUBITEM)) and (ItemIdx >= 0) then
begin
Result := CDRF_SKIPDEFAULT;
R := Sender.LVItemRect( ItemIdx, lvipBounds );
if R.Bottom < 0 then Exit;
for i := 0 to ListView1.LVColCount-1 do
begin
R1 := R;
for j := 0 to i-1 do
inc( R1.Left, Sender.LVColWidth[ j ] );
R1.Right := R1.Left + Sender.LVColWidth[ i ];
Txt := 'Item' + Int2Str( ItemIdx ) + '.' + Int2Str( i );
ProvideColors;
Sender.Canvas.TextRect( R1, R1.Left, R1.Top, Txt );
end;
Sender.Canvas.Brush.Color := clWindow;
Sender.Canvas.Font.Color := clWindowText;
end
else
Result := CDRF_NOTIFYITEMDRAW;
end;

1 użytkowników online, w tym zalogowanych: 0, gości: 1