Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Liste (https://www.delphipraxis.net/91405-liste.html)

daredd 4. Mai 2007 12:17


Liste
 
Tag, hab noch eine Frage.
Ich habe ne liste mit mehrern komponenten, und nun wenn ich mit der maus auf eine komponente gehe also selecte, wird die die zeile der mit blau markiert, die standart farbe in windows für selected objecte.
Ich will aber meine eigene farbe benutzen, bis jetzt habe ich nichts gefunden (property) wo man das ändern könnte. hat da schon jemand erfahrung???

Blackheart 4. Mai 2007 12:35

Re: Liste
 
Ich schätze mal Du meinst Listbox und Items, dann schau mal nach ListBox1DrawItem und Canvas.FillRect da sollest Du hier im Forum einiges zu Finden.

daredd 4. Mai 2007 13:18

Re: Liste
 
Liste der Anhänge anzeigen (Anzahl: 1)
Delphi-Quellcode:
if ((State = [odSelected]) or (State = [odSelected,odFocused])) then Font.Color := clBlack
             else begin
                Font.Color := Colors[TMSchemeItem(CLB.Items.Objects[Index]).IndGrp mod 16];
                Brush.Color := clwhite;
             end;
             if ((State = [odSelected]) or (State = [odSelected,odFocused])) then Brush.Color := $00A9EBEB
             else begin
             Brush.Color := clwhite;
             end;
hier noch mal das gesammte:
Delphi-Quellcode:
procedure TpfFormPolling.clbSchemeDrawItem(Control: TWinControl;
  Index: integer; Rect: TRect; State: TOwnerDrawState);
var
   CLB : TCheckListBox;
   RectSize : integer;
   Item : TMSchemeItem;
begin
     CLB := (Control as TCheckListBox);
     with CLB.Canvas do begin
          Font.Name := 'Arial';
          FillRect(Rect);
          RectSize := Rect.Bottom - Rect.Top;
          Item := TMSchemeItem(CLB.Items.Objects[Index]);
          if Item.Grayed then begin
             Font.Color := clBlack;
             TextOut(Rect.Left + RectSize + 3, Rect.Top + 3, CLB.Items[Index]);
             Font.Color := clBlack;
             TextOut(Rect.Left + RectSize + 2, Rect.Top + 2, CLB.Items[Index]);
          end else begin
             if ((State = [odSelected]) or (State = [odSelected,odFocused])) then Font.Color := clBlack
             else begin
                Font.Color := Colors[TMSchemeItem(CLB.Items.Objects[Index]).IndGrp mod 16];
                Brush.Color := clwhite;
             end;
             if ((State = [odSelected]) or (State = [odSelected,odFocused])) then Brush.Color := $00A9EBEB
             else begin
             Brush.Color := clwhite;
             end;
             if (Item.ItemType = rtMoraTherapy) or (Item.ItemType = rtVegetotest) then Font.Style := [fsItalic]
             else Font.Style := [];
             TextOut(Rect.Left + RectSize + 2, Rect.Top + 2, CLB.Items[Index]);
             if Item.Passed then begin
                Brush.Color := $0041D3D9; Brush.Style := bsSolid; Pen.Color := clBlack;
                Ellipse(Rect.Left + 5, Rect.Top + 5, Rect.Left + RectSize - 5, Rect.Bottom - 5);
                if (Item.StatInfo.cTotal = 0) then begin
                   ColorList.LoadStatInfoFromField(GetFieldFromIssled(Item.IndIssl));
                   Item.StatInfo := ColorList.StatInfo;
                end;
                Brush.Color := ColorForListsStatInfo(Item.StatInfo);
                Pen.Color := clBlack;
                Brush.Style := bsSolid;
                Ellipse(Rect.Left + 4, Rect.Top + 4, Rect.Left + RectSize - 6, Rect.Bottom - 6);
                if (Item.StatInfo.cRegion > 0) then begin
                   Brush.Style := bsClear;
                   Pen.Width := 1;
                   Rectangle(Rect.Left + 1, Rect.Top + 1, Rect.Left + RectSize - 3, Rect.Bottom - 3);
                end;
             end;
          end;
     end;
end;
Das ist mein code für Das DrawItem der liste, im angehang (downloads) seht ihr was bei mir raus kommt.
Der mach nicht das gesammte feld in der Farbe die ich will.
Was kann ich da machen????


Alle Zeitangaben in WEZ +1. Es ist jetzt 11:48 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz