Autor Beitrag
Stefan-W
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 475

Win 7 SP1
D2005 PE
BeitragVerfasst: So 03.04.05 00:49 
Hi Leuts,

ich hab mal wieder ein Problem wo ich mit suchen und experimentieren nicht weiter gekommen bin.
Also ich zeige mit hilfe einer ListBox den Inhald einer ICL (Icon-Bibliothek) an.
und nun will ich das ganze mehrzeilig haben... Zu einem Icon gehören aber immer mehrere Icons in den verschiedenen Größen und Farbqualitäten... gut das anzeigen ist kein Problem, nur das mehrzeilige will nicht. Ich hab gedacht das ich das einfach mit der Eigenschaft Columns machen kann (währ auch genau die Form wie ich das am ende haben möchte) aber so einfach ist das nicht... er malt mir schon alle Icons so wie ers soll aber immer nur ein Icon (in seien verschiedenen Formen/Arten) in eine Zeile.
Ich hoffe das jetzt jemand verstanden hat was ich will und mir helfen kann.

danke schonmal im Vorraus!

Tschau
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: So 03.04.05 09:27 
Hallo

ich würde über ownerdrawvariable und drawitem gehen

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
  Tform...
  private
    { Private-Deklarationen }
    clwindowdark:Tcolor;
...
procedure TForm1.FormCreate(Sender: TObject);
Var i:integer;
begin
  clwindowdark:=ColorAdjustLuma(ColorToRGB(clWindow),-15,false);//uses graphutil
  with ListBox1 do
    begin
      style:=lbOwnerDrawVariable;
      for i:=1 to 7 do items.add('Eintrag '+inttostr(i));
    end;
end;

procedure TForm1.ListBox1MeasureItem(Control: TWinControl; Index: Integer;var Height: Integer);
Var itemheight:integer;
begin
  ItemHeight := (Control as Tlistbox).itemheight;
   case index of
    0,3: height := itemheight;
    1,4: height := 2*itemheight;
    2,5: height := 3*itemheight;
   else height := itemheight;end;
end;

procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;Rect: TRect; State: TOwnerDrawState);
Var i:integer;
begin
  with control as TListBox do
    begin
      //Hintergrund, Zebramuster, damit man die Einträge schön auseinander halten kann
      if odd(index) then canvas.Brush.Color := clwindowdark
                    else canvas.Brush.Color := clwindow;
      if odSelected in state then canvas.Brush.Color := clHighlight;
      canvas.FillRect(rect);

      //"Bilder" ausgeben, zum Bleistift nur als text
       case index of
        0,3: canvas.TextOut(rect.Left+2,rect.top+2,'Bild1');
        1,4begin
               for i:=1 to 2 do
                canvas.TextOut(rect.Left+2,rect.top+2+(i-1)*itemheight,'Bild'+inttostr(i));
             end;
        2,5begin
               for i:=1 to 3 do
                canvas.TextOut(rect.Left+2,rect.top+2+(i-1)*itemheight,'Bild'+inttostr(i));
             end;
       else end;

      //Beschriftung
      canvas.TextOut(rect.Left+40,rect.top+2,items[index]);
    end;
end;


Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
Stefan-W Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 475

Win 7 SP1
D2005 PE
BeitragVerfasst: So 03.04.05 10:37 
Danke :D das ist genau das waas ich gesucht hab!
Tschau