All docs
V20.1
20.2 (EAP/Beta)
20.1
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

SpreadsheetControl.RowHeightChanged Event

Occurs after the row height was changed.

Namespace: DevExpress.Xpf.Spreadsheet

Assembly: DevExpress.Xpf.Spreadsheet.v20.1.dll

Declaration

public event RowHeightChangedEventHandler RowHeightChanged
Public Event RowHeightChanged As RowHeightChangedEventHandler

Event Data

The RowHeightChanged event's data class is RowHeightChangedEventArgs. The following properties provide information specific to this event:

Property Description
Index Returns the index of the row whose height was changed.

Remarks

The RowHeightChanged event occurs in the following cases:

See how to specify the row height or column width.

The example below shows how to use the SpreadsheetControl.RowHeightChanged and SpreadsheetControl.ColumnWidthChanged events to keep a picture in the center of the destination cell when a user changes the cell's width or height.

Spreadsheet_ResizeColumnRowEvents

public Form1()
{
    InitializeComponent();
    IWorkbook workbook = spreadsheetControl.Document;
    Worksheet worksheet = workbook.Worksheets.ActiveWorksheet;

    // Add a picture to cell B2.
    Cell destCell = worksheet.Cells["B2"];
    Picture picture = worksheet.Pictures.AddPicture("DxLogo.png", destCell);
    // Specify the cell width and height.
    double cellWidth = destCell.ColumnWidth = picture.Width + 150;
    double cellHeight = destCell.RowHeight = picture.Height + 50;

    // Center the picture in the cell.
    double columnOffset = (destCell.ColumnWidth - picture.Width) / 2;
    double rowOffset = (destCell.RowHeight - picture.Height) / 2;
    picture.Move((float)rowOffset, (float)columnOffset);

    spreadsheetControl.ColumnWidthChanged += (s, e) =>
    {
        if (e.Index == destCell.ColumnIndex)
        {
            // Move the picture to keep it in the center of the cell.
            columnOffset = (destCell.ColumnWidth - cellWidth) / 2;
            picture.Left += (float)columnOffset;
            cellWidth = destCell.ColumnWidth;
        }
    };

    spreadsheetControl.RowHeightChanged += (s, e) =>
    {
        if (e.Index == destCell.RowIndex)
        {
            // Move the picture to keep it in the center of the cell.
            rowOffset = (destCell.RowHeight - cellHeight) / 2;
            picture.Top += (float)rowOffset;
            cellHeight = destCell.RowHeight;
        }
    };
}

Implements

See Also