怎样对Tfontstyle这个集合进行操作
我要自定义一个Tfontstyle的子集,
然后对该子集进行include操作,怎样实现

解决方案 »

  1.   

    type  TSonFontStyle = set of TFontStyle;....
      Include(TSonFontStyle,SomeValue);
      

  2.   

    for I:=0 to length(charcount)-1 do
            begin
               {LUOIB  fsBold, fsItalic, fsUnderline, fsStrikeOut}
                ch:=charcount[i];
                case ch of
                   'L':include(TSonFontStyle,fsUnderline);
                   'U':include(TSonFontStyle,fsUnderline);
                   'O':include(TSonFontStyle,fsStrikeOut);
                   'I':include(TSonFontStyle,fsItalic);
                   'B':include(TSonFontStyle,fsbold);
                end;
            end;我这样写错在那里
      

  3.   

    同意楼上,补充:
    type  TSonFontStyle = set of TFontStyle;procedure TForm1.Button1Click(Sender: TObject);
    var
      F:TSonFontStyle;
    begin
      Include(f, fsItalic);
      f:=f+[fsUnderline,fsStrikeOut];
    end;
      

  4.   

    Case语句的选择因子必须是有顺类型,而不能用非有序类型的如字符传作为选择因子!
      

  5.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
      F:TSonFontStyle;
      i:integer;
      ch:char;
      charcount:string;
    begin
      Include(f, fsItalic);
      f:=f+[fsUnderline,fsStrikeOut];
      for I:=0 to length(charcount)-1 do
      begin
         {LUOIB  fsBold, fsItalic, fsUnderline, fsStrikeOut}
          ch:=charcount[i];
          case ch of
             'L':include(F,fsUnderline);
             'U':include(F,fsUnderline);
             'O':include(F,fsStrikeOut);
             'I':include(F,fsItalic);
             'B':include(F,fsbold);
          end;
      end;
    end;