property Column.Width as Long
Retrieves or sets the column's width.

 TypeDescription 
   Long A long expression that indicates the column's width.  

The Width property resizes a column at runtime. Use the AutoWidth property to compute the width that's required to fit all cells in the column. Use the WidthAutoResize property to automatically resize the column while the user expands or collapses items. Use the Visible property to hide a column. The ColumnAutoResize property specifies whether the visible columns fit the control's client area. If the ColumnAutoResize property is True, the Width property may not resize the column to the desired value, because all visible columns must fit the control's client area. By default, the control adds horizontal scroll bar when required. Use the ScrollBars property to add or remove the control's scroll bars. Use the Visible property to hide the column. Use the FilterBarDropDownWidth property to specify the width of the drop down filter window.

The following VB sample shows how to set the width for all columns:

Private Sub Grid1_AddColumn(ByVal Column As EXGRIDLibCtl.IColumn)
    Column.Width = 128
End Sub

The following VB.NET sample  changes the column's width when a new column is added:

Private Sub AxGrid1_AddColumn(ByVal sender As Object, ByVal e As AxEXGRIDLib._IGridEvents_AddColumnEvent) Handles AxGrid1.AddColumn
    e.column.Width = 128
End Sub

The following C# sample changes the column's width when a new column is added:

private void axGrid1_AddColumn(object sender, AxEXGRIDLib._IGridEvents_AddColumnEvent e)
{
	e.column.Width = 128;
}

The following C++ sample changes the column's width when a new column is added:

#include "Column.h"
#include "Columns.h"
void OnAddColumnGrid1(LPDISPATCH Column) 
{
	CColumn column( Column );
	column.SetWidth( 128 );
}

The following VFP sample changes the column's width when a new column is added:

*** ActiveX Control Event ***
LPARAMETERS column

with column
	.Width = 128
endwith

 


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