首页 > 解决方案 > 我正在尝试使用 AdvancedColorInfo 类,但不知道如何实例化它

问题描述

private AdvancedColorInfo advancedColorInfo = new AdvancedColorInfo();

我已经尝试了上面的代码,但是得到了这个错误:

“AdvancedColorInfo 不包含采用 0 个参数的构造函数。”</p>

我正在尝试使用该方法IsHdrMetadataFormatCurrentlySupported,因此我需要创建AdvancedColorInfo该类的一个实例。

我尝试更改文档中提到的 UWP Windows 版本,但没有成功。

如何获得 的实例AdvancedColorInfo

标签: c#.netgraphics

解决方案


要得到一个AdvancedColorInfo你不要new他们直接起来。

相反,您需要:

var displayInfo = DisplayInformation.GetForCurrentView();
var colorInfo = displayInfo.GetAdvancedColorInfo();
var isHDRSupported = colorInfo.IsHdrMetadataFormatCurrentlySupported(yourFormatPassInHere);

第一个方法调用是static调用获取DisplayInformation. 二是AdvancedColorInfoDisplayInformation.


推荐阅读