NtRowHeader.InitRowHeaderText Method

Initializes the NtRowHeader with a simple text and a brush to draw the background area. The text will be drawn in a position defined by the member textPos relative to the top left edge of the NtRowHeader.
 
Please note that it is ok to combine it with a call of InitRowHeaderBitmap(). If you call both members (no matter of the order) then the NtRowHeader will be drawn like this:
 
1. The background is painted using bkBrush member.
2. The bitmap is drawn on the background.
3. The text is drawn possibly overlapping the bitmap.
 
This methodology gives you the maximum flexibility to set up your Row Header. Of course, if the drawing of simple text does not fit the needs, it is fine to draw well rendered text into the bitmap directly and then initialize the Row Header with the bitmap, only. This is anyway a good technique as it has higher performance on drawing compared to a row header that uses both text and bitmap.

Overload List:

Modifier / Return Value Name and Parameters Description

public virtual void

InitRowHeaderText ( string text, Font font, Brush textBrush, Brush bkBrush, Graphics g )

Initializes the NtRowHeader with a text and background brush.

Return value:

void

Parameters:

string text
The text to be drawn on this Row Header.

Font font
The Font used to draw the text.

Brush textBrush
The Brush used to draw the text.

Brush bkBrush
The Brush used to paint the complete rectangle of this Row Header before applying the text or bitmap.

Graphics g
The Graphics object used only during the call to this method (not stored in a member). It is used to calculate the text size using the given font.

Remarks:

If you want to change the text, textBrush or font, do not directly assign a new value to the member. Rather call this method InitRowHeaderText in order to ensure a correct recalculation of the text size, which is needed internally. You can change the bitmap by assigning a new bitmap to this member at any time. It will directly be used on the next painting of the Row Header. The same fits for the bkBrush and the textPos members.
 
InitRowHeaderText() sets the text position to X=5 and Y=3 which sets a little space between the top left borders and the text. If this does not fit your needs you can afterwards set the appropriate position. Therefore you can make use of the member textSize what was calculated by InitRowHeaderText() in case you want to center your text e.g. Still in most cases left or right aligned text are the best choice for readability.

See also:

InitRowHeaderBitmap()