我不是 C++ 专家,但需要将旧项目更新为 Embarcadero C++ Builder XE7。
此代码无法编译(fpFixed 行):
#include <System.UITypes.hpp>
...
NewText->Font->Pitch = fpFixed;
音高在哪里:
__property System::Uitypes::TFontPitch Pitch = {read=GetPitch, write=SetPitch, default=0};
void __fastcall SetPitch(const System::Uitypes::TFontPitch Value);
和
enum class DECLSPEC_DENUM TFontPitch : unsigned char { fpDefault, fpVariable, fpFixed };
错误:“E2451 未定义符号 'fpFixed'”
另外两次尝试:
NewText->Font->Pitch = TFontPitch.fpFixed;
NewText->Font->Pitch = System::Uitypes::TFontPitch.fpFixed;
两者都有错误:E2108 typedef 'TFontPitch' 使用不当
但这 - 奇怪的是 - 编译,没有警告:
System::Uitypes::TFontPitch( fpFixed ); // yes,no assignments here just an unused value
NewText->Font->Pitch = fpFixed;
这是什么解释,我在这里做错了吗?刚刚通过反复试验得出了这个“解决方案”。