共用方式為


IVsHiColorItem.GetColorData Method

Retrieves the RGB value for the specified element.

Namespace:  Microsoft.VisualStudio.TextManager.Interop
Assembly:  Microsoft.VisualStudio.TextManager.Interop.8.0 (in Microsoft.VisualStudio.TextManager.Interop.8.0.dll)

Syntax

'宣告
Function GetColorData ( _
    cdElement As Integer, _
    <OutAttribute> ByRef pcrColor As UInteger _
) As Integer
'用途
Dim instance As IVsHiColorItem
Dim cdElement As Integer
Dim pcrColor As UInteger
Dim returnValue As Integer

returnValue = instance.GetColorData(cdElement, _
    pcrColor)
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

Parameters

Return Value

Type: System.Int32
If successful, returns S_OK; otherwise, returns an error code.

Remarks

COM Signature

From textmgr2.idl

interface IVsHiColorItem : IUnknown
    {
        HRESULT GetColorData([in] VSCOLORDATA cdElement,
                             [out] COLORREF* pcrColor);
    };

Note that the returned RGB value is a Win32 COLORREF value.

In managed code, an RGB value can be converted to a COLORREF value with the code:

    uint colorRef = (uint)System.Drawing.ColorTranslator.ToWin32(
                              System.Drawing.Color.FromArgb(r, g, b));

In unmanaged code, use the RGB macro to create a COLORREF value, for example, RGB(0x00, 0xff,0x00).

.NET Framework Security

See Also

Reference

IVsHiColorItem Interface

IVsHiColorItem Members

Microsoft.VisualStudio.TextManager.Interop Namespace