Autor Beitrag
FriFra
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 557

Win XP Prof, Win XP Home,Win Server 2003,Win 98SE,Win 2000,Win NT4,Win 3.11,Suse Linux 7.3 Prof,Suse Linux 8.0 Prof
D2k5 Prof, D7 Prof, D5 Standard, D3 Prof, K3 Prof
BeitragVerfasst: So 25.01.04 16:09 
Weiss jemand, wie ich in einer Spalte eines ListView mehrzeiligen Text darstellen kann? Es wäre auch schön, so etwas wie automatischen Umbruch bei zu langem Test zu bekommen...

_________________
Michael
(principal certified lotus professional - developer)
MSCH
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1448
Erhaltene Danke: 3

W7 64
XE2, SQL, DevExpress, DevArt, Oracle, SQLServer
BeitragVerfasst: So 25.01.04 17:40 
geht leider nur, wenn du das Zeichnen der Einträge selbst übernimmst und dann via DrawText(...,dt_wordBreak) den Text zeichnest.
grez
msch

_________________
ist das politisch, wenn ich linksdrehenden Joghurt haben möchte?
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 25.01.04 20:16 
MSCH hat folgendes geschrieben:
geht leider nur, wenn du das Zeichnen der Einträge selbst übernimmst und dann via DrawText(...,dt_wordBreak) den Text zeichnest.
grez
msch

Hallo

Hast du das schonmal gemacht?
Ich meine das zeichnen an sich ist nicht das Problem. Aber wie tust du die Höhe der Listviewzeile ändern?

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: So 25.01.04 20:37 
Am einfachsten ginge es wohl mit Mike Lischke's Virtual Treeview.
Alexander F
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 149

Win XP, Win 2000
D6 PE, D7 Prof, D8 Prof
BeitragVerfasst: So 25.01.04 21:59 
Mich würde das auch mal interessieren wie man das mach, wäre cool wenn du das etwas genauer erklären könntest ;-)
MSCH
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1448
Erhaltene Danke: 3

W7 64
XE2, SQL, DevExpress, DevArt, Oracle, SQLServer
BeitragVerfasst: Di 27.01.04 22:14 
Der Nachteil bei Listviews ist, man kann die Höhe eines einzelnen Eintrags nicht definieren; allerdings geht das für alle mit einem Trick; Erstelle eine ImageList deren Icons die entsprechende Höhe haben (z.b.32x32) und weise diese Imagelist der Listview als SMALLIMAGE zu. Nun werden alle Items in der Höhe gezeichnet, dass das Icon reinpasst. Du kannst z.b. ein leeres Icon nehmen - sozusagen als Platzhalter - und den einzelnen Items als ImageIndex -1 zuweisen.

Ist zwar nicht die Feine englische Art, aber es funktioniert.

Hier übrigens die Zeichenmethode:
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:
procedure TTempListView.ListeAdvancedCustomDrawSubItem(Sender: TCustomListView;
  Item: TListItem; SubItem: Integer; State: TCustomDrawState;
  Stage: TCustomDrawStage; var DefaultDraw: Boolean);
var Rect,N: TRect;
    H:integer;
    S:String;
begin
  // nur subitem 6 zeichnen, rest so lassen
  if SubItem=6 then begin
    H:=0;
    // richtige Koordinaten sammeln
    for I:=0 to 5 do
      Inc(H,Sender.Column[i].Width);
   // und etwas kleiner , damit der Focusrect noch erscheinen kann
    Rect.Left:= H+1;
    Rect.Right:= Rect.Left + Sender.Column[6].Width-1;
    Rect.Top:= Item.getposition.Y+1;
    N:=Item.DisplayRect(dricon);
    Rect.Bottom:= (N.Bottom)-1;
    with Sender.Canvas do begin
      Brush.Color:= clSkyBlue;
      Inc(rect.Left,2);Inc(Rect.Top,2);Dec(Rect.Right);Dec(Rect.Bottom,1);
      FillRect(Rect);
      // text des Subitems holen
      S:= Item.SubItems[Subitem-1];
      Font.Color:= clYellow;
      SetBkMode(Handle,Transparent);
      // text zeichnen
      DrawText(handle,@S[1],length(S)-1,Rect,DT_LEFT or DT_WORDBREAK);
    end;
    DefaultDraw:=false;
  end else
    DefaultDraw:= true;
end;


nur mal so, ungetestet aus'm schädel geschrieben, also keine Kritik bitte :-)

grez
msch

_________________
ist das politisch, wenn ich linksdrehenden Joghurt haben möchte?