IVsPackageDefinedTextMarkerType.DrawGlyphWithColors Method

Definition

Draws a glyph in the given display context and bounding rectangle using the provided colors.

public:
 int DrawGlyphWithColors(IntPtr hdc, cli::array <Microsoft::VisualStudio::OLE::Interop::RECT> ^ pRect, int iMarkerType, Microsoft::VisualStudio::TextManager::Interop::IVsTextMarkerColorSet ^ pMarkerColors, System::UInt32 dwGlyphDrawFlags, int iLineHeight);
public int DrawGlyphWithColors (IntPtr hdc, Microsoft.VisualStudio.OLE.Interop.RECT[] pRect, int iMarkerType, Microsoft.VisualStudio.TextManager.Interop.IVsTextMarkerColorSet pMarkerColors, uint dwGlyphDrawFlags, int iLineHeight);
abstract member DrawGlyphWithColors : nativeint * Microsoft.VisualStudio.OLE.Interop.RECT[] * int * Microsoft.VisualStudio.TextManager.Interop.IVsTextMarkerColorSet * uint32 * int -> int
Public Function DrawGlyphWithColors (hdc As IntPtr, pRect As RECT(), iMarkerType As Integer, pMarkerColors As IVsTextMarkerColorSet, dwGlyphDrawFlags As UInteger, iLineHeight As Integer) As Integer

Parameters

hdc
IntPtr

nativeint

[in] Handle to a display device context that defines the visible region of interest.

pRect
RECT[]

[in] Pointer to a RECT structure that defines the bounding rectangle for the marker.

iMarkerType
Int32

[in] Integer containing the marker type.

pMarkerColors
IVsTextMarkerColorSet

[in] Pointer to a marker colors object.

dwGlyphDrawFlags
UInt32

[in] Options for drawing the glyph in the widget margin. For a list of dwGlyphDrawFlags values, see GLYPHDRAWFLAGS

iLineHeight
Int32

[in] Integer specifying the line height.

Returns

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

Remarks

COM Signature

From textmgr.idl:

HRESULT IVsPackageDefinedTextMarkerType::DrawGlyphWithColors(  
   [in] HDC hdc, [in] RECT *pRect,   
   [in] long iMarkerType,   
   [in] IVsTextMarkerColorSet *pMarkerColors,   
   [in] DWORD dwGlyphDrawFlags,   
   [in] long iLineHeight  
);  

This method is called by the environment if you specify a value of MV_GLYPH for your marker type. To use this method, draw your glyph on the visible region of interest specified by the hdc parameter within the bounding rectangle. Instead of hard coding colors, use the pMarkerColors parameter to call GetMarkerColors and return the colors from the current marker type or related markers so that you are synchronized with the user's color customizations. The reason IVsTextMarkerColorSet is used to determine colors is that some marker types use glyph colors that are different from their inline text colors and are keyed off of other markers.

Follow these guidelines when implementing DrawGlyphWithColors:

Do not draw anything outside of the bounding rectangle that returns with the pRect parameter.

Use Graphics Device Interface (GDI) primitives rather than bitmaps, because the size of a line can vary over a wide number of sizes and scaling of graphics is required. However, if you do want to use bitmaps, provide a variety of bitmap sizes so that you can stretch them to properly work on all the available line sizes that the user can set, including very large sizes for accessibility needs.

Do not draw any text in your marker for scaling purposes. Even universal symbols, like an exclamation point, are discouraged.

If you specified a value of MV_MULTILINE_GLYPH in your marker style, this function is called twice for every painting pass — once to paint the interior and tail of the glyph, and again to draw the top. The value for dwGlyphDrawFlags passed into this method indicates what to do:

If GDF_MULTILINE is not passed in, then just draw the top edge of the marker.

If GDF_MULTILINEis specified, then you have to do some computations based on other flags to fill in the marker glyph area. If GDF_BOTTOMEDGEis passed in, then uses the bottom line height's portion of the input bounding rectangle to draw a tail of the glyph. If GDF_TOPEDGE is passed in, then uses the top line height's portion to draw the top of the glyph. Any remaining room in the input bounding rectangle is the interior and should be painted by your function.

Applies to