DrawFilledBoxWithText

Draws a filled or shaded box with text for the given width and height at the specifiy location.

DrawFilledBoxWithText(xText As Single, yText As Single, Text As String, FontDictionaryName As String,
                      FontSize As Single, TextAlignment As Single, TextColor As Color, xBox As Single,
                      yBox As Single, BoxWidth As Single, BoxHeight As Single, BorderColor As Color,
                      BoxFillColor As Color, BorderThickness As Single,
                      Optional BoxCapStyle As pdf.LineCapStyle = pdf.LineCapStyle.Squared)

Values passed to this procedure:

xText, yTextx, y coordinates on the page you want to draw the text.
TextThe text to draw.
FontDictionaryNameThe name used to reference the font within the document Font Dictionary. The FontDictionaryName is assigned to the font when you call LoadFont.
FontSizeFont size to be used.
TextAlignmentText alignment (Center, Left or Right).

If the text alignment is left, it is the text beginning position. If the alignment is right, its the ending position. If the alignment is center, its the middle position.
TextColorColor of the text.
xBox, yBoxx, y coordinates on the page you want to draw the box. This is the top left position of the box.
BoxWidthBox width.
BoxHeightBox height.
BorderColorColor of box border.
BoxFillColorColor of box fill.
BorderThicknessThickness of the border.
BoxCapStyleOptional. The box cap style specifies the shape to be used at the ends of each line that makes up the box. The three types are:

Squared - the stroke is squared off at the endpoint of the path. There is no projection beyond the end of the path.

Round - a semicircular arc with a diameter equal to the line width is drawn around the endpoint and filled in.

ProjectingSquare - The stroke continues beyond the endpoint of the path for a distance equal to half the line width and is squared off.

The default is Squared.

Example

DrawFilledBoxWithText(PageWidthInInch / 2, 7, "Blue text, centered in a fill box", "VerdanaBoldItalic", 20,
                      pdf.TextAlignment.Center, Color.Blue, 0.2, 7.35, .PageWidthInInch - 0.4, 0.5,
                      Color.Green, Color.LightGray, 0.02, pdf.LineCapStyle.Squared)
Sample text in filled box