例如:
如何取出窗体中当前设定的Font.Style的名称啊?

解决方案 »

  1.   

    if fsbold in font.style then
      listbox1.items.add('粗体');
    if fsitalic in font.style then
      listbox1.items.add('斜体');
    ...
      

  2.   

    font.style只是一个集合啊,好象没有你说的名称吧。
      

  3.   

    没错啊,如果集合包含fsBold,就说明字体是粗体,
      

  4.   

    font.style:=[fsBold,fsXXX,fsXXX];
    记忆里应该只这样的!!希望你能看懂!!:)
      

  5.   

    To root3646(虫子) 
    我不懂!我不想和你多说什么!
    你自己去试试我的程序就知道谁不懂了!
      

  6.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TMainForm = class(TForm)
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      MainForm: TMainForm;implementation
    uses TypInfo;{$R *.dfm}procedure TMainForm.Button1Click(Sender: TObject);
    var
      I: Integer;
    begin
      for I := 0 to 3 do
        if Byte(Canvas.Font.Style) and (1 shl I) <> 0 then
          ShowMessage(GetEnumName(TypeInfo(TFontStyle), I));
    end;procedure TMainForm.FormCreate(Sender: TObject);
    begin
      Canvas.Font.Style := [fsItalic, fsUnderLine];
    end;end.
      

  7.   

    var h,l,i:integer;s:string;
    begin
      l:=ord(low(TFontStyle));
      h:=ord(high(TFontStyle));
      for i:=l to h do
      begin
        s:=GetEnumName(typeinfo(TFontStyle),i);
        self.ListBox1.Items.Append(s);
      end;
    end;
      

  8.   

    请教  xzgyb(老达摩) 和 citytramper(^o^) 
    GetEnumName是个什么函数?
      

  9.   

    帮助文件中没有
    在typinfo.pas中