ActiveReports 19 .NET Edition
MESCIUS.ActiveReports.Design.Win Assembly / GrapeCity.ActiveReports.Design Namespace / Designer Class / LayoutChanging Event
Example

In This Topic
    LayoutChanging Event
    In This Topic
    Raised when the layout is changing and passes the sender a new EventArgs class called LayoutChangingArgs.
    Syntax
    'Declaration
     
    Public Event LayoutChanging As LayoutChangingEventHandler
    public event LayoutChangingEventHandler LayoutChanging
    Remarks
    This event provides a mechanism to monitor and potentially cancel changes to the report's layout before they are applied. It can be useful for enforcing constraints, validating changes, or implementing custom behavior in response to layout adjustments.

    Handlers can inspect the event arguments to determine the nature of the proposed change and decide whether to allow it, modify it, or prevent it from occurring.

    Example
    Private Sub ardMain_LayoutChanging(ByVal sender As Object, ByVal e As Design.LayoutChangingArgs) Handles ardMain.LayoutChanging
        If e.Type = Design.LayoutChangeType.SectionDelete Then
            Dim Result As DialogResult
            Result = MessageBox.Show("Are you sure you want to delete this section?", "Delete?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1)
            If Result = DialogResult.Cancel Then
                e.AllowChange = False
            Else
                e.AllowChange = True
            End If
        End If
    End Sub
    private void ardMain_LayoutChanging(object sender, GrapeCity.ActiveReports.Design.LayoutChangingArgs e) 
    { 
        if (e.Type == Design.LayoutChangeType.SectionDelete)  
        {  
            DialogResult Result;  
            Result = MessageBox.Show("Are you sure you want to delete this section?", "Delete?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);  
            if (Result == DialogResult.Cancel)  
            {  
                e.AllowChange = false;  
            }  
            else  
            {  
                e.AllowChange = true;  
            }  
        }  
    }
    See Also