字体的style怎么保存到文本文件里?

解决方案 »

  1.   

    写入到ini文件里面
    myini.writinteger('set','fontstyle',fs...)
      

  2.   

    比如关闭窗体的时候我现在要把Edit1的字体style存到文本里,再打开时还原要怎么做
      

  3.   

    look        WriteInteger(SectionName, 'Font.Charset', Charset);
            WriteInteger(SectionName, 'Font.Color', Color);
            WriteInteger(SectionName, 'Font.Height', Height);
            WriteString(SectionName, 'Font.Name', Name);
            WriteInteger(SectionName, 'Font.Size', Size);
            WriteBool(SectionName, 'Font.Style.Bold', fsBold in Style);
            WriteBool(SectionName, 'Font.Style.Italic', fsItalic in Style);
            WriteBool(SectionName, 'Font.Style.Underline', fsUnderline in Style);
            WriteBool(SectionName, 'Font.Style.StrikeOut', fsStrikeOut in Style);
      

  4.   

    oh
    忘了
    with font do
      begin
       ... ...
      end
      

  5.   

    WriteInteger(SectionName, 'Font.Charset', Charset);
            WriteInteger(SectionName, 'Font.Color', Color);
            WriteInteger(SectionName, 'Font.Height', Height);
            WriteString(SectionName, 'Font.Name', Name);
            WriteInteger(SectionName, 'Font.Size', Size);
            WriteBool(SectionName, 'Font.Style.Bold', fsBold in Style);
            WriteBool(SectionName, 'Font.Style.Italic', fsItalic in Style);
            WriteBool(SectionName, 'Font.Style.Underline', fsUnderline in Style);
            WriteBool(SectionName, 'Font.Style.StrikeOut', fsStrikeOut in Style);
      

  6.   

    with IniNote, RichEdit_myNote.Font do
            begin
            Charset := ReadInteger(SectionName, 'Font.Charset', Font.Charset);
            Color   := ReadInteger(SectionName, 'Font.Color', Font.Color);
            Height  := ReadInteger(SectionName, 'Font.Height', Font.Height);
            Name    := ReadString(SectionName, 'Font.Name', Font.Name);
            Size    := ReadInteger(SectionName, 'Font.Size', Font.Size);
            if ReadBool(SectionName, 'Font.Style.Bold', False) then
               Style := Style + [fsBold]
            else if fsBold in Style then
               Style := Style - [fsBold] ;
            if ReadBool(SectionName, 'Font.Style.Italic', False) then
               Style := Style + [fsItalic]
            else if fsItalic in Style then
               Style := Style - [fsItalic] ;
            if ReadBool(SectionName, 'Font.Style.Underline', False) then
               Style := Style + [fsUnderline]
            else if fsUnderline in Style then
               Style := Style - [fsUnderline] ;
            if ReadBool(SectionName, 'Font.Style.StrikeOut', False) then
               Style := Style + [fsStrikeOut]
            else if fsStrikeOut in Style then
               Style := Style - [fsStrikeOut] ;
            end ; //of with
      

  7.   

    //参考如下代码
    uses TypInfo;procedure TForm1.Button1Click(Sender: TObject);
    begin
      Edit1.Text := GetSetProp(Font, 'Style');
    end;procedure TForm1.Button2Click(Sender: TObject);
    begin
      SetSetProp(Font, 'Style', Edit1.Text);
    end;
      

  8.   

    To:myy() BCB代码有点问题。再看看