Partager via


IVsFontAndColorEvents.OnFontChanged Method

Called by the Visual Studio environment when the fonts of one Categories of the items listed in the Display Items drop-down list is modified.

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

Syntax

'Declaration
Function OnFontChanged ( _
    ByRef rguidCategory As Guid, _
    pInfo As FontInfo(), _
    pLOGFONT As LOGFONTW(), _
    HFONT As UInteger _
) As Integer
int OnFontChanged(
    ref Guid rguidCategory,
    FontInfo[] pInfo,
    LOGFONTW[] pLOGFONT,
    uint HFONT
)
int OnFontChanged(
    [InAttribute] Guid% rguidCategory, 
    [InAttribute] array<FontInfo>^ pInfo, 
    [InAttribute] array<LOGFONTW>^ pLOGFONT, 
    [InAttribute] unsigned int HFONT
)
abstract OnFontChanged : 
        rguidCategory:Guid byref * 
        pInfo:FontInfo[] * 
        pLOGFONT:LOGFONTW[] * 
        HFONT:uint32 -> int
function OnFontChanged(
    rguidCategory : Guid, 
    pInfo : FontInfo[], 
    pLOGFONT : LOGFONTW[], 
    HFONT : uint
) : int

Parameters

  • rguidCategory
    Type: Guid%

    [in] Specifies the GUID of the affected category. Compare this GUID to the GUID of your category to determine whether the event applies to your VSPackage.

  • HFONT
    Type: UInt32

    [in] Pointer to a font object.

Return Value

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

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsFontAndColorEvents::OnFontChanged(
   [in] REFGUID rguidCategory,
   [in] const FontInfo *pInfo,
   [in] const LOGFONTW *pLOGFONT,
   [in] HFONT hFont
);

Fonts are defined for on a Category basis, not a Display Items basis: all DisplayItems in a Category share the same font.

The bFaceNameValid, bPointSizeValid, and bCharSetValid, members of the returned FontInfo object (pInfo) indicate whether the corresponding font attributes have changed. Invalid attributes should be ignored. If all attributes are marked as invalid, pLOGFONT is NULL (C++) or nulla null reference (Nothing in Visual Basic) (C#).

The hFont parameter is included so that you need not create two separate HFONT objects, as creating an HFONT object is a resource-intensive activity. The parameter may be nulla null reference (Nothing in Visual Basic), in which case the method creates an HFONT object as needed.

.NET Framework Security

See Also

Reference

IVsFontAndColorEvents Interface

Microsoft.VisualStudio.Shell.Interop Namespace