HOME PAGE | DOWNLOAD | TUTORIALS | XtraReports
Devexpress

Sunday, July 22, 2012

How to: Dynamically Control the Height of Individual Rows

The following code demonstrates a GridView.CalcRowHeight event handler.

This event is used to specify heights of individual rows. It is assumed that a View (gridView1) displays data from the System.Data.DataView data source, which contains the RowHeight column. This column specifies the height to set for a specific row.

C#

using DevExpress.XtraGrid.Views.Grid;

 

private void gridView1_CalcRowHeight(object sender, RowHeightEventArgs e) {

    if(e.RowHandle >= 0)

        e.RowHeight = (int)gridView1.GetDataRow(e.RowHandle)["RowHeight"];

}

 

VB

Imports DevExpress.XtraGrid.Views.Grid
 
Private Sub GridView1_CalcRowHeight(ByVal sender As Object, _
ByVal e As RowHeightEventArgs) Handles GridView1.CalcRowHeight
    If e.RowHandle >= 0 Then
        e.RowHeight = GridView1.GetDataRow(e.RowHandle)("RowHeight")
    End If
End Sub

 

No comments:

Post a Comment