共用方式為


IVsFontAndColorUtilities.EncodeTrackedItem(Int32, Int32, UInt32) Method

Definition

Returns a RGB (COLORREF) color value corresponding to a color tracked in the Visual Studio environment.

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

Parameters

iItemToTrack
Int32

[in] An index indicating a visual component whose color must be tracked.

aspect
Int32

[in] A member of the __VSCOLORASPECT enumeration.

pcrResult
UInt32

[out] A COLORREF representation corresponding to the color of the aspect of the tracked visual component.

Returns

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

The member of the __VSCOLORASPECT enumeration supplied as the aspect argument indicates if the foreground or background color of the tracked item is to be used.

The value of pcrResult returned indicates that the component's color is being tracked and that its value may change.

If aspect has a value of CA_BACKGROUND the COLORREF will have a type of CT_TRACK_BACKGROUND as returned by the GetColorType method.

If aspect has a value of CA_FOREGROUND the COLORREF will have a type of CT_TRACK_FOREGROUND.

Managed code can obtain functionality equivalent to GetSysColor with SystemColors and convert between COLORREF and the System.Drawing.Color structure using M:System.Drawing.ColorTranslator.FromWin32 and M:System.Drawing.ColorTranslator.ToWin32.

Applies to