我从传统的Delphi 2010应用程序中获取此代码.
var InternalServices: TThemeServices;
function ThemeServices: TThemeServices;
begin
if InternalServices = nil then
InternalServices := ThemeServicesClass.Create;
Result := InternalServices;
end;
Run Code Online (Sandbox Code Playgroud)
编译器告诉我ThemeServicesClass.Create不存在.我应该如何在Delphi XE8中执行此操作?
您在问题中包含的代码将从VCL的Themes单元中解除.该代码不应由您编译.您的应用程序编译该代码而不是使用该Themes单元中的代码可能总是错误的.
在XE8中,你应该调用StyleServices方法Vcl.Themes.名称的改变(从ThemeServices到StyleServices),是反映这一事实,老XP主题支持现在已被VCL风格增强.
据我所知,您的问题中的代码不应由您编译.它应该删除.它可能是更大的代码片段的一部分,也可能执行可疑的行为.如果没有完全看到该代码,我们就无法向您提供明确的建议.