共用方式為


IVsFontAndColorStorage Interface

Allows a VSPackage to retrieve or save font and color data to the registry.

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

Syntax

'Declaration
<InterfaceTypeAttribute()> _
<GuidAttribute("40BC7B1A-E625-4DA1-86B4-7660F3CCBB16")> _
Public Interface IVsFontAndColorStorage
[InterfaceTypeAttribute()]
[GuidAttribute("40BC7B1A-E625-4DA1-86B4-7660F3CCBB16")]
public interface IVsFontAndColorStorage
[InterfaceTypeAttribute()]
[GuidAttribute(L"40BC7B1A-E625-4DA1-86B4-7660F3CCBB16")]
public interface class IVsFontAndColorStorage
[<InterfaceTypeAttribute()>]
[<GuidAttribute("40BC7B1A-E625-4DA1-86B4-7660F3CCBB16")>]
type IVsFontAndColorStorage =  interface end
public interface IVsFontAndColorStorage

The IVsFontAndColorStorage type exposes the following members.

Methods

  Name Description
Public method CloseCategory Closes the registry key containing font and color information for the Display Items in the currently open Category.
Public method GetFont Returns the font attributes for the currently open Category.
Public method GetItem Returns the user-modifiable information for a named Display Item in the currently open Category.
Public method OpenCategory Opens the registry key containing font and color information for a Cateogry found in the Show Settings for: drop-down list.
Public method RemoveCategory Deletes saved data for a Category from the registry.
Public method SetFont Stores the basic definition of a font to be used by the currently open Category.
Public method SetItem Stores the user-modifiable color and font settings for a named Display Item in the registry.

Top

Remarks

The Visual Studio environment provides an implementation of the IVsFontAndColorStorage interface

Notes to Implementers

COM programmers can obtain an IVsFontAndColorStorage interface by calling QueryService with the service ID SID_SVsFontAndColorStorage and the interface ID IID_IVsFontAndColorStorage:

    CComPtr<IVsFontAndColorStorage>  pStorage;
    hr = pSP->QueryService(SID_SVsFontAndColorStorage, IID_IVsFontAndColorStorage, (void**)&pStorage);
    VSASSERT(SUCCEEDED(hr), "IVsFontAndColorStorage not provided");

VSPackages developed using managed code can obtain an IVsFontAndColorStorage interface by calling GetService with an argument of SVsFontAndColorStorage:

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

Notes to Callers

See Also

Reference

Microsoft.VisualStudio.Shell.Interop Namespace

IVsFontAndColorStorage2