property Grid.HeaderHeight as Long
Retrieves or sets a value indicating the control's header height.

 TypeDescription 
   Long A long expression that indicates the height of the control's header bar.  

By default, the HeaderHeight property is 18 pixels. Use the HeaderHeight property to change the height of the control's header bar. Use the HeaderVisible property to hide the control's header bar. Use the LevelKey property to display the control's header bar using multiple levels. Use the FormatLevel property to display multiple levels in the column's header. If the control displays the header bar using multiple levels the HeaderHeight property gets the height in pixels of a single level in the header bar. The control's header displays multiple levels if there are two or more neighbor columns with the same non empty level key. Use the HTMLCaption property to display multiple lines in the column's caption. Use the Add method to add new columns to the control. If the HeaderSingleLine property is False, the HeaderHeight property specifies the maximum height of the control's header when the user resizes the columns.

The following VB sample displays a header bar using multiple lines:

With Grid1
        .BeginUpdate
            .HeaderHeight = 32
            With .Columns.Add("Column 1")
                .HTMLCaption = "Line1<br>Line2"
            End With
            With .Columns.Add("Column 2")
                .HTMLCaption = "Line1<br>Line2"
            End With
        .EndUpdate
End With

The following C++ sample displays a header bar using multiple lines:

#include "Columns.h"
#include "Column.h"
m_grid.BeginUpdate();
m_grid.SetHeaderHeight( 32 );
m_grid.SetHeaderVisible( TRUE );
CColumn column1( V_DISPATCH( &m_grid.GetColumns().Add( "Column 1" ) ) );
	column1.SetHTMLCaption( "Line1<br>Line2" );
CColumn column2( V_DISPATCH( &m_grid.GetColumns().Add( "Column 2" ) ) );
	column2.SetHTMLCaption( "Line1<br>Line2" );
m_grid.EndUpdate();

The following VB.NET sample displays a header bar using multiple lines:

With AxGrid1
    .BeginUpdate()
    .HeaderVisible = True
    .HeaderHeight = 32
    With .Columns.Add("Column 1")
        .HTMLCaption = "Line1<br>Line2"
    End With
    With .Columns.Add("Column 2")
        .HTMLCaption = "Line1<br>Line2"
    End With
    .EndUpdate()
End With

The following C# sample displays a header bar using multiple lines:

axGrid1.BeginUpdate();
axGrid1.HeaderVisible = true;
axGrid1.HeaderHeight = 32;
EXGRIDLib.Column column1 = axGrid1.Columns.Add("Column 1") as EXGRIDLib.Column ;
column1.HTMLCaption = "Line1<br>Line2";
EXGRIDLib.Column column2 = axGrid1.Columns.Add("Column 2") as EXGRIDLib.Column;
column2.HTMLCaption = "Line1<br>Line2";
axGrid1.EndUpdate();

The following VFP sample displays a header bar using multiple lines:

with thisform.Grid1
	.BeginUpdate()
	.HeaderVisible = .t.
	.HeaderHeight = 32
	with .Columns.Add("Column 1")
		.HTMLCaption = "Line1<br>Line2"
	endwith
	with .Columns.Add("Column 2")
		.HTMLCaption = "Line1<br>Line2"
	endwith
	.EndUpdate()
endwith

Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.