Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Wort in Listbox mit Fett anzeigen? (https://www.delphipraxis.net/9433-wort-listbox-mit-fett-anzeigen.html)

DSeven 26. Sep 2003 12:01


Wort in Listbox mit Fett anzeigen?
 
Hallo

Ich möchte ein Wort in der ganzen IteList Fett anzeigen lassen. Wie geht das?

Also zum Beispiel steht in den Items
Hallo. Delphi Cool
Delphi is the best.

Und dann soll das Wört "Delphi" in beiden items fett angezeigt werden.
Danke

CalganX 26. Sep 2003 12:45

Re: Wort in Listbox mit Fett anzeigen?
 
Hi,
jetzt würde ich einfach mal sagen selber zeichnen.
Schau dir mal das Ereignis OnDrawItem an.

Chris

T-Olli 26. Sep 2003 12:51

Re: Wort in Listbox mit Fett anzeigen?
 
Um das in einer ListBox hinzubekommen wirst du die Ausgabe selber übernehmen müssen (style=lbOwnerDrawFixed). Die entsprechend OnDrawItem Routine könnte z.B. so aussehen:
Code:
procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;
begin
  Rect: TRect; State: TOwnerDrawState);
  with (Control as TListBox).Canvas do
  begin
    FillRect(Rect);
    PenPos := Rect.TopLeft;
    TextOut(PenPos.x, PenPos.y, 'Normale Schrift ');
    Font.Style := Font.Style + [fsBold];
    TextOut(PenPos.x, PenPos.y, 'Fette Schrift');
    Font.Style := Font.Style - [fsBold];
    TextOut(PenPos.x, PenPos.y, ' und weiter mit normaler Schrift');
  end;
end;

DSeven 26. Sep 2003 13:22

Re: Wort in Listbox mit Fett anzeigen?
 
Hallo

Danke werds so machen.


Alle Zeitangaben in WEZ +1. Es ist jetzt 13:41 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