c# - 我正在尝试使用 AdvancedColorInfo 类,但不知道如何实例化它
问题描述
private AdvancedColorInfo advancedColorInfo = new AdvancedColorInfo();
我已经尝试了上面的代码,但是得到了这个错误:
“AdvancedColorInfo 不包含采用 0 个参数的构造函数。”</p>
我正在尝试使用该方法IsHdrMetadataFormatCurrentlySupported
,因此我需要创建AdvancedColorInfo
该类的一个实例。
我尝试更改文档中提到的 UWP Windows 版本,但没有成功。
如何获得 的实例AdvancedColorInfo
?
解决方案
要得到一个AdvancedColorInfo
你不要new
他们直接起来。
相反,您需要:
var displayInfo = DisplayInformation.GetForCurrentView();
var colorInfo = displayInfo.GetAdvancedColorInfo();
var isHDRSupported = colorInfo.IsHdrMetadataFormatCurrentlySupported(yourFormatPassInHere);
第一个方法调用是static
调用获取DisplayInformation
. 二是AdvancedColorInfo
从DisplayInformation
.
推荐阅读
- r - 在 R 中使用行函数时出现意外的“,”
- jquery - 如果选中单选按钮,则显示隐藏 div
- c++ - 使用均匀分布的随机数进行蒙特卡罗模拟
- typescript - 在 TypeScript 中循环设置对象字段
- android - 在没有 GUI 和 HAL 的 android 系统上解决配对 pin 交换
- javascript - 如何在 Next.js 中过滤道具?无法从 Next.js 中的 componentDidMount 过滤道具中的数据
- coq - Coq:在“隐式”之后应出现语法错误“类型”或“类型”
- regex - 在循环中动态构建正则表达式模式 - 不平衡括号错误
- arrays - 如何保存函数的返回数组?
- google-apps-script - 如何在插入大量数据时修复“访问文档时服务文档失败”?