IVsHiColorItem::GetColorData Method (Int32, UInt32)

 

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)

int GetColorData(
	int cdElement,
	[OutAttribute] unsigned int% pcrColor
)

Parameters

cdElement
Type: System::Int32

[in] A value from the __tagVSCOLORDATA enumeration identifying the element for which to get the color.

pcrColor
Type: System::UInt32

[out] The requested RGB value.

Return Value

Type: System::Int32

If successful, returns S_OK; otherwise, returns an error code.

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).

Return to top
Show: