Partager via


IVsFontAndColorUtilities Interface

Definition

Provides tools for working with the input and output data used by the methods of the Visual Studio Font and Color mechanism.

public interface class IVsFontAndColorUtilities
public interface class IVsFontAndColorUtilities
__interface IVsFontAndColorUtilities
[System.Runtime.InteropServices.Guid("A356A017-07EE-4D06-ACDE-FEFDBB49EB50")]
[System.Runtime.InteropServices.InterfaceType(1)]
public interface IVsFontAndColorUtilities
[<System.Runtime.InteropServices.Guid("A356A017-07EE-4D06-ACDE-FEFDBB49EB50")>]
[<System.Runtime.InteropServices.InterfaceType(1)>]
type IVsFontAndColorUtilities = interface
Public Interface IVsFontAndColorUtilities
Attributes

Remarks

The methods of the IVsFontAndColorUtilities interface allow a VSPackage to provide Font and Color support tools for working with FontInfo, __FONTCOLORFLAGS, __FCFONTFLAGS, and LOGFONTW, which are used to specify and modify font and color information.

If a VSPackage providing Fonts and Colors changes its default settings, it must call ClearCache or ClearAllCaches. This will force the reloading of Fonts and Colors providers, ensure the propagation of its settings and the currency of future Fonts and Colors queries.

Note

Many of the methods in this interface work with color data stored as a COLORREF, consistent with the Windows 32 SDK GetSysColor function. A COLORREF (RGB) has the hex format of 0x00bbggrr. 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.

Notes to Callers

The IVsFontAndColorUtilities is obtained from the SVsFontAndColorStorage service implementation.

VSPackages developed using managed code can obtain an IVsFontAndColorCacheManager interface by calling GetService(Type) with an argument of SVsFontAndColorStorage and casting to IVsFontAndColorUtilities:

IVsFontAndColorUtilities store=null;  
store=GetService(typeof(SVsFontAndColorStorage)) as IVsFontAndColorUtilities;  
if (store == null ){  
    throw new ApplicationException("Unable to obtain IVsFontAndColorUtilities Interface");  

}

COM programmers can obtain an IVsFontAndColorCacheManager interface by calling QueryService(Guid, Guid, IntPtr) with

a service ID SID_SVsFontAndColorStorage and the interface ID IID_IVsFontAndColorUtilities:

CComPtr<IVsFontAndColorUtilities> srpFCCacheMgr;  
pSP->QueryService(SID_SVsFontAndColorStorage , IID_IVsFontAndColorUtilities , (void**)&srpFCCacheMgr);  
VSASSERT(SUCCEEDED(hr), " IVsFontAndColorUtilities not provided");  

Methods

CopyFontInfo(FontInfo[], FontInfo[])

Copies font information from one FontInfo object into another.

CopyItemInfo(AllColorableItemInfo[], AllColorableItemInfo[])

Copies information contained in one AllColorableItemInfo object to another AllColorableItemInfo object.

EncodeAutomaticColor(UInt32)

Returns the current value of the Visual Studio session automatic color as an RGB (COLORREF) value.

EncodeIndexedColor(COLORINDEX, UInt32)

Translates a member of the COLORINDEX enumeration into its RGB (COLORREF) color value equivalent.

EncodeInvalidColor(UInt32)

Returns a RGB (COLORREF) color value corresponding to the system defined invalid color.

EncodeSysColor(Int32, UInt32)

Returns a RGB (COLORREF) color value corresponding to a specified system color component.

EncodeTrackedItem(Int32, Int32, UInt32)

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

EncodeVSColor(Int32, UInt32)

Returns the COLORREF equivalent of a __VSSYSCOLOREX color.

FreeFontInfo(FontInfo[])

Free all data in a contained FontInfo object.

FreeItemInfo(AllColorableItemInfo[])

Free all data in a contained AllColorableItemInfo object

GetColorType(UInt32, Int32)

Obtain the type of color representation in a COLORREF.

GetEncodedIndex(UInt32, COLORINDEX[])

Obtain a valid member of the COLORINDEX enumeration corresponding to a supplied COLORREF.

GetEncodedSysColor(UInt32, Int32)

Obtain a System Color service index corresponding to a supplied COLORREF.

GetEncodedVSColor(UInt32, Int32)

Obtain a valid member of the __VSSYSCOLOREX enumeration corresponding to a supplied COLORREF.

GetRGBOfEncodedColor(UInt32, UInt32, Guid, UInt32)

Obtain the RGB value of a created tracking or indexed COLORREF representation of a color.

GetRGBOfIndex(COLORINDEX, UInt32)

Obtain the RGB value corresponding to a valid member of the COLORINDEX enumeration.

GetRGBOfItem(AllColorableItemInfo[], Guid, UInt32, UInt32)

Obtain the RGB (COLORREF) values of the foreground and background color of a Font and Color Category from an instance of AllColorableItemInfo.

GetTrackedItemIndex(UInt32, Int32, Int32)

Obtain the index of a tracked color as represented by a COLORREF and a member of the __VSCOLORASPECT indicated if the color was used in the foreground or background.

InitFontInfo(FontInfo[])

Initializes a FontInfo object to a default state.

InitItemInfo(AllColorableItemInfo[])

Initializes an AllColorableItemInfo object to a default state.

Applies to