Projede kullanıcıya uyarı vermek için sohwmessage kullanılamıyor, onun yerine uyarıları listbboxsa insert komutuyla yeni kayıt girişi sağlıyorum, buraya kadar sorun yok, fakat listboxsa yeni bir kayıt girişi yapılınca o satırı font veya zemin renginin yaklaşık 10 sefer renk değişikliği nasıl yaptırabilirim, buradaki amaç kullanıcının dikkatini çekmek
procedure TMainForm.MesListDrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
begin
with (Control as TListBox).Canvas do
begin
if Index = 0 then
begin
Brush.Color := RGB(255, 0, 0);
Font.Color := RGB(0, 0, 0);
Sleep(100);
end;
begin
if Index mod 2 = 0 then
begin
Brush.Color := RGB(248, 248, 255);
Font.Color := RGB(0, 0, 0);
end;
Brush.Style := bsSolid;
FillRect(Rect);
Brush.Style := bsClear;
TextOut(Rect.Left, Rect.Top, (Control as TListBox).Items[Index]);
end;
end;
end;
procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
var Ix : Integer;
begin
with (Control as TListBox).Canvas do
begin
If Index = 0 Then
Begin
Brush.Color := $00FFD2A6;
FillRect(Rect);
TextOut(Rect.Left, Rect.Top, (Control as TListBox).Items[Index]);
for Ix := 1 to 5 do
Begin
Sleep(100);
DrawFocusRect(Rect);
End;
End;
end;
end;