Listbox yeni kayıt girişi

Delphi'de kod yazma ile ilgili sorularınızı bu foruma yazabilirsiniz.
Cevapla
Kullanıcı avatarı
Serhat
Üye
Mesajlar: 203
Kayıt: 27 Tem 2014 11:10

Listbox yeni kayıt girişi

Mesaj gönderen Serhat »

Merhaba;

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

Kod: Tümünü seç

Listbox.Items.Insert(0,'yenikayıt');
Kullanıcı avatarı
brs
Üye
Mesajlar: 626
Kayıt: 04 Eki 2012 03:52

Re: Listbox yeni kayıt girişi

Mesaj gönderen brs »

Timer kullanmayı denediniz mi.
İşi bilen yardım eder, az bilen akıl verir, bilmeyen eleştirir, yapamayan ise çamur atar...
Kullanıcı avatarı
Serhat
Üye
Mesajlar: 203
Kayıt: 27 Tem 2014 11:10

Re: Listbox yeni kayıt girişi

Mesaj gönderen Serhat »

selam.

Konu güncel arkadaşlar...

Sleep(100); kullandım fakat bir işe yaramadı.

Kod: Tümünü seç

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;
Kullanıcı avatarı
badkursat
Üye
Mesajlar: 84
Kayıt: 03 Mar 2014 08:58

Re: Listbox yeni kayıt girişi

Mesaj gönderen badkursat »

Kod: Tümünü seç

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;

Kod: Tümünü seç

procedure TForm1.Button1Click(Sender: TObject);
begin
  ListBox1.Items.Add('asd');
  ListBox1DrawItem(ListBox1,0,ListBox1.ItemRect(0),[odSelected]);
end;
bkz: http://stackoverflow.com/questions/8563 ... rent-color
Bu soruyu cevaplayan SimaWB yani forumun bir yerlerinde de benzer bir örnek vardır.
Cevapla