Подскажите, почему не работает преобразование множества TFontStyles в Byte?
- Код: Выделить всё
function MyFontStyleToString(FS: TFontStyles): string;
var
B: Byte;
begin
B := byte(FS); // <<< Illegal type conversion
Result := '$' + HexStr(B, 6);
end;
Модератор: Модераторы
function MyFontStyleToString(FS: TFontStyles): string;
var
B: Byte;
begin
B := byte(FS); // <<< Illegal type conversion
Result := '$' + HexStr(B, 6);
end;
procedure Test;
var
Font: TFont;
begin
Font := TFont.Create;
Font.Style := [fsBold, fsItalic];
ShowMessage('Font Styles = ' + GetStrProp(Font, 'Style'));
end;
function FontToReadableStr(Font: TFont): string;
begin
Result := SetToString(GetPropInfo(Font, 'Style'), Integer(Font.Style), False);
end;
procedure Test;
var
F: TFont;
begin
F := TFont.Create;
F.Style := [fsBold, fsItalic];
ShowMessage('Font Styles = ' + FontToReadableStr(F));
end;
Сейчас этот форум просматривают: Google [Bot] и гости: 227