event LayoutChanged ()
Occurs when column's position or column's size is changed.

TypeDescription

The LayoutChanged event notifies your application once a column is resized or moved by drag and drop. Also, the LayoutChanged event may be fired if the item's position is changed by drag and drop using the AutoDrag property. 

Syntax for LayoutChanged event, /NET version, on:

private void LayoutChanged(object sender)
{
}

Private Sub LayoutChanged(ByVal sender As System.Object) Handles LayoutChanged
End Sub

Syntax for LayoutChanged event, /COM version, on:

private void LayoutChanged(object sender, EventArgs e)
{
}

void OnLayoutChanged()
{
}

void __fastcall LayoutChanged(TObject *Sender)
{
}

procedure LayoutChanged(ASender: TObject; );
begin
end;

procedure LayoutChanged(sender: System.Object; e: System.EventArgs);
begin
end;

begin event LayoutChanged()
end event LayoutChanged

Private Sub LayoutChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LayoutChanged
End Sub

Private Sub LayoutChanged()
End Sub

Private Sub LayoutChanged()
End Sub

LPARAMETERS nop

PROCEDURE OnLayoutChanged(oGrid)
RETURN

Syntax for LayoutChanged event, /COM version (others), on:

<SCRIPT EVENT="LayoutChanged()" LANGUAGE="JScript">
</SCRIPT>

<SCRIPT LANGUAGE="VBScript">
Function LayoutChanged()
End Function
</SCRIPT>

Procedure OnComLayoutChanged 
	Forward Send OnComLayoutChanged 
End_Procedure

METHOD OCX_LayoutChanged() CLASS MainDialog
RETURN NIL

void onEvent_LayoutChanged()
{
}

function LayoutChanged as v ()
end function

function nativeObject_LayoutChanged()
return

Because the LayoutChanged event can occur for different reasons, you can identify the action that caused it by saving the ItemFromPoint and/or ColumnFromPoint during the MouseDown event. The following VB sample shows how:

Dim iItemFromPointMouseDown As Long
Dim iColumnFromPointMouseDown As Long

Private Sub Form_Load()
    iItemFromPointMouseDown = 0
    iColumnFromPointMouseDown = -1
End Sub

Private Sub Grid1_LayoutChanged()
    If (iItemFromPointMouseDown <> 0) Then
            Debug.Print "Items section changed"
        Else
        If (iColumnFromPointMouseDown <> -1) Then
            Debug.Print "Columns section changed"
        Else
            Debug.Print "Others"
        End If
    End If
    iItemFromPointMouseDown = 0
    iColumnFromPointMouseDown = -1
End Sub

Private Sub Grid1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim c As Long, hit As HitTestInfoEnum
    With Grid1
        iItemFromPointMouseDown = .ItemFromPoint(-1, -1, c, hit)
        iColumnFromPointMouseDown = .ColumnFromPoint(-1, -1)
    End With
End Sub

The sample displays:

You can use the LayoutChanged event to save the columns position and size for future use. Use the Width property to retrieve the column's width. Use the Position property to retrieve the column's position. The Visible property specifies whether a column is shown or hidden. Use the ColumnAutoResize property to specify whether the visible columns fit the control's client area.

There are two options to avoid losing the columns  proportions: