将 TFont.Pitch 转换为整数值?
Convert TFont.Pitch into an Integer value?
我使用这种方法将 TFont.Pitch
转换为 Integer
值:
var
ThisPitch: Integer;
case Font.Pitch of
TFontPitch.fpDefault: ThisPitch := 0;
TFontPitch.fpVariable: ThisPitch := 1;
TFontPitch.fpFixed: ThisPitch := 2;
end;
是否有更简单的方法将 TFont.Pitch
转换为 Integer
值?
TFontPitch
枚举值与您要转换成的数值相同,因此简单的 Ord()
转换就足够了:
var
ThisPitch: Integer;
ThisPitch := Ord(Font.Pitch);
我使用这种方法将 TFont.Pitch
转换为 Integer
值:
var
ThisPitch: Integer;
case Font.Pitch of
TFontPitch.fpDefault: ThisPitch := 0;
TFontPitch.fpVariable: ThisPitch := 1;
TFontPitch.fpFixed: ThisPitch := 2;
end;
是否有更简单的方法将 TFont.Pitch
转换为 Integer
值?
TFontPitch
枚举值与您要转换成的数值相同,因此简单的 Ord()
转换就足够了:
var
ThisPitch: Integer;
ThisPitch := Ord(Font.Pitch);