Partager via


IVsHiColorItem.GetColorData(Int32, UInt32) Method

Definition

Retrieves the RGB value for the specified element.

public:
 int GetColorData(int cdElement, [Runtime::InteropServices::Out] System::UInt32 % pcrColor);
int GetColorData(int cdElement, [Runtime::InteropServices::Out] unsigned int & pcrColor);
public int GetColorData (int cdElement, out uint pcrColor);
abstract member GetColorData : int * uint32 -> int
Public Function GetColorData (cdElement As Integer, ByRef pcrColor As UInteger) As Integer

Parameters

cdElement
Int32

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

pcrColor
UInt32

[out] The requested RGB value.

Returns

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

Applies to