Partager via


IVsUIShell2.GetVSSysColorEx Method

Returns the RGB settings for the specified system color used by the environment.

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

Syntax

'Declaration
Function GetVSSysColorEx ( _
    dwSysColIndex As Integer, _
    <OutAttribute> ByRef pdwRGBval As UInteger _
) As Integer
int GetVSSysColorEx(
    int dwSysColIndex,
    out uint pdwRGBval
)
int GetVSSysColorEx(
    [InAttribute] int dwSysColIndex, 
    [OutAttribute] unsigned int% pdwRGBval
)
abstract GetVSSysColorEx : 
        dwSysColIndex:int * 
        pdwRGBval:uint32 byref -> int
function GetVSSysColorEx(
    dwSysColIndex : int, 
    pdwRGBval : uint
) : int

Parameters

  • dwSysColIndex
    Type: Int32

    [in] A value from the __VSSYSCOLOREX enumeration specifying the system color to retrieve.

  • pdwRGBval
    Type: UInt32%

    [out] A 32-bit word containing the RGB value.

Return Value

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

Remarks

COM Signature

From vsshell80.idl:

HRESULT IVsUIShell2::GetVSSysColorEx(
   [in]  VSSYSCOLOREX  dwSysColIndex,
   [out] DWORD        *pdwRGBval
);

This method supersedes the GetVSSysColor method.

This method is analogous to the Win32 API GetSysColor function and returns the RGB settings for the various system colors used by Visual Studio. These values change depending upon the implemented Windows desktop scheme.

The RGB value returned by the GetVSSysColorEx method is a 32-bit, Windows color value in the format of a COLORREF value.

C++ code can directly use the returned RGB value by using the macros that support COLORREFs, such as GetRValue, GetGValue and GetBValue.

Managed code that uses returned colors can use the T:System.Drawing.Color structure, which can be obtained from the 32-bit Windows color value by using the M:System.Drawing.ColorTranslator.FromWin32(System.Int32) method.

For a full discussion on best practices for choosing the correct color values when designing a user interface, see The Visual Studio UI Guidelines document.

.NET Framework Security

See Also

Reference

IVsUIShell2 Interface

Microsoft.VisualStudio.Shell.Interop Namespace