IVsFontAndColorUtilities Interface

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

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

Syntax

'Declaration
<GuidAttribute("A356A017-07EE-4D06-ACDE-FEFDBB49EB50")> _
<InterfaceTypeAttribute()> _
Public Interface IVsFontAndColorUtilities
[GuidAttribute("A356A017-07EE-4D06-ACDE-FEFDBB49EB50")]
[InterfaceTypeAttribute()]
public interface IVsFontAndColorUtilities
[GuidAttribute(L"A356A017-07EE-4D06-ACDE-FEFDBB49EB50")]
[InterfaceTypeAttribute()]
public interface class IVsFontAndColorUtilities
[<GuidAttribute("A356A017-07EE-4D06-ACDE-FEFDBB49EB50")>]
[<InterfaceTypeAttribute()>]
type IVsFontAndColorUtilities =  interface end
public interface IVsFontAndColorUtilities

The IVsFontAndColorUtilities type exposes the following members.

Methods

  Name Description
Public method CopyFontInfo Copies font information from one FontInfo object into another.
Public method CopyItemInfo Copies information contained in one AllColorableItemInfo object to another AllColorableItemInfo object.
Public method EncodeAutomaticColor Returns the current value of the Visual Studio session automatic color as an RGB (COLORREF) value.
Public method EncodeIndexedColor Translates a member of the COLORINDEX enumeration into its RGB (COLORREF) color value equivalent.
Public method EncodeInvalidColor Returns a RGB (COLORREF) color value corresponding to the system defined invalid color.
Public method EncodeSysColor Returns a RGB (COLORREF) color value corresponding to a specified system color component.
Public method EncodeTrackedItem Returns a RGB (COLORREF) color value corresponding to a color tracked in the Visual Studio environment.
Public method EncodeVSColor Returns the COLORREF equivalent of a __VSSYSCOLOREX color.
Public method FreeFontInfo Free all data in a contained FontInfo object.
Public method FreeItemInfo Free all data in a contained AllColorableItemInfo object
Public method GetColorType Obtain the type of color representation in a COLORREF.
Public method GetEncodedIndex Obtain a valid member of the COLORINDEX enumeration corresponding to a supplied COLORREF.
Public method GetEncodedSysColor Obtain a System Color service index corresponding to a supplied COLORREF.
Public method GetEncodedVSColor Obtain a valid member of the __VSSYSCOLOREX enumeration corresponding to a supplied COLORREF.
Public method GetRGBOfEncodedColor Obtain the RGB value of a created tracking or indexed COLORREF representation of a color.
Public method GetRGBOfIndex Obtain the RGB value corresponding to a valid member of the COLORINDEX enumeration.
Public method GetRGBOfItem Obtain the RGB (COLORREF) values of the foreground and background color of a Font and Color Category from an instance of AllColorableItemInfo.
Public method GetTrackedItemIndex 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.
Public method InitFontInfo Initializes a FontInfo object to a default state.
Public method InitItemInfo Initializes an AllColorableItemInfo object to a default state.

Top

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 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 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");

See Also

Reference

Microsoft.VisualStudio.Shell.Interop Namespace

Other Resources

Fonts