Einzelnen Beitrag anzeigen

mr_emre_d
(Gast)

n/a Beiträge
 
#9

Re: Anzahl Elemente in "set of"

  Alt 8. Apr 2009, 11:57
probier mal das hier
Delphi-Quellcode:
type
  TFontStyle = (fsBold, fsItalic, fsStrikeOut, fsUnderline);
  TFontStyles = set of TFontStyle;

const
  FS = [fsBold, fsItalic, fsUnderline];

function CntAttr( Fnts: TFontStyles ): Byte;
var
  i: Integer;
begin
  Result := 0;
  for i := 0 to $FF do
    if TFontStyle(i) in Fnts then
      inc( Result );
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  ShowMessage( IntToStr( CntAttr( FS ) ) ); // zeig mir 3 an :)
end;
  Mit Zitat antworten Zitat