简体   繁体   English

Color.FromArgb(...); 安全信息

[英]Color.FromArgb(…); security message

I am defining a Color from argb , ex 我正在定义一个来自argb的颜色,例如

Color.FromArgb(255,255,0,0);

In visual studio 2012 , winRT application it says that this is tagged with [security critical] . 在visual studio 2012中,winRT应用程序表示它被标记为[security critical]。 Are there any reasons why? 有什么理由吗? I tried searching, no results. 我试过搜索,没有结果。 And no idea why this relates to security. 并且不知道为什么这与安全性有关。

Update: 更新:

Now I notice, not only does FromArgb(...); 现在我注意到,不仅FromArgb(...); methods gives this [SECURITY CRITICAL] warning. 方法给出了[SECURITY CRITICAL]警告。 any of these: 任何这些:

c.A = 255;
c.R = 255;
c.G = 0;
c.B = 0;

Also does. 也是。

System.Drawing is a wrapper around unmanaged GDI+ code. System.Drawing是非托管GDI +代码的包装器。 From my understanding, WinRT does not support GDI+: 根据我的理解,WinRT不支持GDI +:

http://social.msdn.microsoft.com/Forums/en-NZ/winappswithnativecode/thread/0ba00fbd-183f-4df6-afa2-04d0ac14706a http://social.msdn.microsoft.com/Forums/en-NZ/winappswithnativecode/thread/0ba00fbd-183f-4df6-afa2-04d0ac14706a

Native rendering code will need to be done with Direct2D. 需要使用Direct2D完成本机渲染代码。

Your message is not a Warning , is information about method signature attribute. 您的消息不是警告 ,是有关方法签名属性的信息。

SECURITY CRITICAL is a code Attribute wich real class name is SecurityCriticalAttribute. SECURITY CRITICAL是一个代码属性,其真正的类名是SecurityCriticalAttribute。 This attribute must be given to methods thats need full trust to execute code ( usually native code calls, unsafe code, graphics resources (wich usually needs unmanaged code etc.) ). 必须将此属性赋予需要完全信任才能执行代码的方法(通常是本机代码调用,不安全代码,图形资源(通常需要非托管代码等))。

If methods are not granted full trust the Security Critical method raise an exception. 如果未授予方法完全信任,则安全关键方法会引发异常。

more info: http://msdn.microsoft.com/en-us/library/system.security.securitycriticalattribute.aspx 更多信息: http//msdn.microsoft.com/en-us/library/system.security.securitycriticalattribute.aspx

您应该使用System.Windows.MediaColor

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Windows Phone 8阵列设置Color.FromArgb - Windows phone 8 array to set Color.FromArgb Color.FromArgb如何将Int32作为参数? - How can Color.FromArgb take Int32 as parameter? 不能在 DataGridView 单元格 BackColor 中使用 Color.FromArgb - Cannot use Color.FromArgb in DataGridView cell BackColor 无法使用 Color.FromArgb 设置透明度(但 Color.Transparent 有效) - Unable to set transparency using Color.FromArgb (but Color.Transparent works) Color.FromArgb(Int32,Int32,Int32)超出范围 - Out of range in Color.FromArgb(Int32,Int32,Int32) 给定一个可以为空的int时返回Color.FromArgb的最佳实践C# - Best practices for returning a Color.FromArgb when given an int that may be null C# 如何使用 Int Array To Color.fromargb 并创建新图像 c# - How To Use Int Array To Color.fromargb And Create A New Image c# C#无模式对话框:如何从无模式对话框返回3个不同的值到主窗体,并将它们放在一起用作Color.FromARGB? - C# Modeless Dialog: How to return 3 different values from modeless dialog to main form and put them together to use as Color.FromARGB? System.Drawing.Color转换FromArgb问题 - System.Drawing.Color convert FromArgb issue 使用ToArgb()后跟FromArgb()不会产生原始颜色 - Using ToArgb() followed by FromArgb() does not result in the original color
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM