字体,大小,颜色和粗体啦之类的。越详细越好
所有信息都写到个memo里或有什么办法保存起来,下次还是用这次的设置

解决方案 »

  1.   

    TFont = class(TGraphicsObject)
      private
        FColor: TColor;
        FPixelsPerInch: Integer;
        FNotify: IChangeNotifier;
        procedure GetData(var FontData: TFontData);
        procedure SetData(const FontData: TFontData);
      protected
        procedure Changed; override;
        function GetHandle: HFont;
        function GetHeight: Integer;
        function GetName: TFontName;
        function GetPitch: TFontPitch;
        function GetSize: Integer;
        function GetStyle: TFontStyles;
        function GetCharset: TFontCharset;
        procedure SetColor(Value: TColor);
        procedure SetHandle(Value: HFont);
        procedure SetHeight(Value: Integer);
        procedure SetName(const Value: TFontName);
        procedure SetPitch(Value: TFontPitch);
        procedure SetSize(Value: Integer);
        procedure SetStyle(Value: TFontStyles);
        procedure SetCharset(Value: TFontCharset);
      public
        constructor Create;
        destructor Destroy; override;
        procedure Assign(Source: TPersistent); override;
        property FontAdapter: IChangeNotifier read FNotify write FNotify;
        property Handle: HFont read GetHandle write SetHandle;
        property PixelsPerInch: Integer read FPixelsPerInch write FPixelsPerInch;
      published
        property Charset: TFontCharset read GetCharset write SetCharset;
        property Color: TColor read FColor write SetColor;
        property Height: Integer read GetHeight write SetHeight;
        property Name: TFontName read GetName write SetName;
        property Pitch: TFontPitch read GetPitch write SetPitch default fpDefault;
        property Size: Integer read GetSize write SetSize stored False;
        property Style: TFontStyles read GetStyle write SetStyle;
      end;
    //---  if FontDialog1.Execute then
      begin
        memo1.Lines.Add( FontDialog1.Font.Name );
        memo1.Lines.Add( IntToStr(FontDialog1.Font.Size) );
        .....
      end;
      

  2.   

    TFontStyles,TFontPitch等枚举或集合类型的属性转换成字符串形式存到文件中,读出来的时候再转换回去
    如:
    //保存
      if FontDialog1.Execute then
      begin
        with FontDialog1.Font do
        begin
          //集合类型
          if (fsBold in Style) then
            memo1.Lines.Add('FontBold=1');
          
          //枚举类型
          if (Pitch = fpFixed) then
            memo1.Lines.Add('FontPitch=3');
     
        end;
      end;