Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   TFontDialog: wie einzelne Style-Typen extrahieren ? (https://www.delphipraxis.net/146656-tfontdialog-wie-einzelne-style-typen-extrahieren.html)

HannsW 24. Jan 2010 17:52


TFontDialog: wie einzelne Style-Typen extrahieren ?
 
Guten Abend.
Bevor ich einen Fontdialog aufrufe setze ich u.a. auch den Style
Delphi-Quellcode:
     FontDialog1.Font.Style:= [];
     if fsBold1 then
          FontDialog1.Font.Style:= FontDialog1.Font.Style + [fsBold];
     if fsItalic1 then
          FontDialog1.Font.Style:= FontDialog1.Font.Style + [fsItalic];
      ...
Wie kann ich jetzt nach Execute feststellen, welche Style-Art gesetzt wurde?
Delphi-Quellcode:
    if FontDialog1.Execute then begin
        FontName1 := FontDialog1.Font.Name;
        fontSize1 := FontDialog1.Font.Size;
        fsBold1 := ???????
Danke Hanns

Matze 24. Jan 2010 18:47

Re: TFontDialog: wie einzelne Style-Typen extrahieren ?
 
Hallo,

das geht beispielsweise so:

Delphi-Quellcode:
fsBold1 := fsBold in FontDialog1.Font.Style; // falls fsBold1 ein Boolean ist
Analog geht es mit den anderen Styles. Im folgenden Beispiel als if-Anweisung:

Delphi-Quellcode:
if fsBold in FontDialog1.Font.Style then
  ShowMessage('bold');

if fsItalic in FontDialog1.Font.Style then
  ShowMessage('italic');

if fsUnderline in FontDialog1.Font.Style then
  ShowMessage('underline');

if fsStrikeOut in FontDialog1.Font.Style then
  ShowMessage('strike out');
Grüße, Matze

HannsW 25. Jan 2010 02:14

Re: TFontDialog: wie einzelne Style-Typen extrahieren ?
 
:thumb: Danke Matze,
das Wars

happy Hanns


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