Gets or sets the text displayed within the painted column header.
A string value representing the painted column header's text. An empty string if the column button or the space not occupied by column headers is painted.
The Caption property can be used for the following two purposes:
- Read the Caption property value to obtain the caption of the column whose header is painted. This can be used to paint the obtained text within the header.
- Assign a custom value to the Caption property. If the event parameter's CustomDrawEventArgs.Handled property is not set to true, the control will paint the header with the assigned text.
Use the CustomDrawColumnHeaderEventArgs.CaptionRect property to determine the boundaries in which the caption text is intended to be drawn. Note, that column headers can also contain images specifying the order of sorting performed by column values. The bounding rectangle of this image can be obtained via the CustomDrawColumnHeaderEventArgs.SortShapeRect property.