检索具有指定元素的 RGB 值。
命名空间: Microsoft.VisualStudio.TextManager.Interop
程序集: Microsoft.VisualStudio.TextManager.Interop.8.0(在 Microsoft.VisualStudio.TextManager.Interop.8.0.dll 中)
语法
声明
Function GetColorData ( _
cdElement As Integer, _
<OutAttribute> ByRef pcrColor As UInteger _
) As Integer
int GetColorData(
int cdElement,
out uint pcrColor
)
int GetColorData(
[InAttribute] int cdElement,
[OutAttribute] unsigned int% pcrColor
)
abstract GetColorData :
cdElement:int *
pcrColor:uint32 byref -> int
function GetColorData(
cdElement : int,
pcrColor : uint
) : int
参数
cdElement
类型:Int32[in] 从标识组件的 __tagVSCOLORDATA 枚举的值获取颜色。
pcrColor
类型:UInt32%[out] 请求的 RGB 值。
返回值
类型:Int32
如果成功,则返回; S_OK否则,返回错误代码。
备注
COM 签名
从 textmgr2.idl
interface IVsHiColorItem : IUnknown
{
HRESULT GetColorData([in] VSCOLORDATA cdElement,
[out] COLORREF* pcrColor);
};
请注意返回的 RGB 值是 Win32 COLORREF 值。
在托管代码中, RGB 值可以转换为代码的一个 COLORREF 值:
uint colorRef = (uint)System.Drawing.ColorTranslator.ToWin32(
System.Drawing.Color.FromArgb(r, g, b));
在非托管代码,请使用 RGB 宏创建 COLORREF 值,例如, RGB(0x00, 0xff,0x00)。
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关详细信息,请参阅通过部分受信任的代码使用库。