Autor Beitrag
Mike_C
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 207

Win XP
D7 Enterprise
BeitragVerfasst: Fr 24.09.04 17:51 
Hi

kann iman irgendwie die Font-settings von TListView.Items verändern? Also jedem Item eine andere Font geben? wenn ja wie?

Gruß Mike_C

_________________
Life is, what some people call a mystery. To me life's just a lesson, you're learning when you're through. So why do we try to understand?
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: Fr 24.09.04 17:53 
selber zeichnen (Forumsuche)

mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)
Mike_C Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 207

Win XP
D7 Enterprise
BeitragVerfasst: Fr 24.09.04 18:02 
tjy, die forumsuche hilft mir da leider nicht weiter. kann mir bitte jemand einen tipp geben, wie ich das selberzeichenen anstelle?

_________________
Life is, what some people call a mystery. To me life's just a lesson, you're learning when you're through. So why do we try to understand?
sourcehunter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 482

Win XP | Suse 10.1
Delphi 2005 Pers.
BeitragVerfasst: Fr 24.09.04 20:23 
Style auf lbOwnerDrawirgendwas stellen und im OnDrawItem-Ereignis Zeile selber malen.

_________________
Linux und OpenSource rulez!
Mike_C Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 207

Win XP
D7 Enterprise
BeitragVerfasst: Sa 25.09.04 13:34 
Ok, das funktioniert teilweise:

also was ich mit meinem LitView vorhabe ist folgendes: ich möchte einen TaskManager schreiben, dem man eine List von Aufgaben geben kann, die bis zu einem gewissen Datum erledigt werden sollen. Also quasi ein elektronisches Aufgabenheft, um meine Zeitplanung für die Uni in den Griff zu bekommen. Jetzt sollen die Aufgaben entsprechend einiger Kriterien verschieden dargestellt werden, z.B. an hand des Datums soll entschieden werden, in welcher Farbe der Eintrag im Listview dargestellt wird. Wenn noch nenügend Zeit bleibt die Aufgabe zu erledigen, soll sie in grün geschriebnen werden, wenn die Zeit knapp wird in geld un wenn man vergessen hat die aufgabe zu erledigen, soll das in rot angezeigt werden.

mit den beiden Events CustomDrawItem und CustomDrawSubItem habe ich das ganze versucht zu realisieren, was bei CustomDrawItem auch funktioniert. nur werden die SubItems nicht angezeigt, wenn ich folgenden Code verwende

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:
procedure TFormMain.lvAufgabenCustomDrawSubItem(Sender: TCustomListView;
  Item: TListItem; SubItem: Integer; State: TCustomDrawState;
  var DefaultDraw: Boolean);
var r, r2: TRect;
    m_Date: TDateTime;
begin
   DefaultDraw := False;

    r := Item.DisplayRect(drBounds);
    r2.Top := r.Top;
    r2.Left := r.Left + (SubItem+1)*Sender.Column[SubItem].Width;
    r2.Bottom := r.Bottom;
    r2.Right := r2.Left + Sender.Column[SubItem].Width;
    Sender.Canvas.Brush.Color := clSilver;
    Sender.Canvas.FillRect(r2);

    m_Date := StrToDate (Item.SubItems[3]);
    if m_Date < Date then begin
       Sender.Canvas.Font.Color := clRed;
       Sender.Canvas.TextOut(r2.Left,r2.Top, Item.SubItems[SubItem]);
    end else
    if m_Date = Date then begin
       Sender.Canvas.Font.Color := clYellow;
       Sender.Canvas.TextOut(r2.Left,r2.Top, Item.SubItems[SubItem]);
    end else
    if m_Date > Date then begin
       Sender.Canvas.Font.Color := clGreen;
       Sender.Canvas.TextOut(r2.Left,r2.Top, Item.SubItems[SubItem]);
    end;
    
end;


kann mir jemand sagen warum?

Gruß MikeC

_________________
Life is, what some people call a mystery. To me life's just a lesson, you're learning when you're through. So why do we try to understand?