HeapProfiler.MainWindow.Activities_PreferredSizeChanged C# (CSharp) Method

Activities_PreferredSizeChanged() private method

private Activities_PreferredSizeChanged ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        private void Activities_PreferredSizeChanged(object sender, EventArgs e)
        {
            if (WindowState == FormWindowState.Minimized)
                return;

            var margin = GroupSnapshots.Left;
            var ps = Activities.GetPreferredSize(new Size(
                GroupSnapshots.Width, ClientSize.Height
            ));

            int newTop = ClientSize.Height - ps.Height - margin;
            var newHeight = newTop - (ps.Height > 0 ? margin : 0) - GroupSnapshots.Top;

            if ((newTop == Activities.Top) && (newHeight == GroupSnapshots.Height))
                return;

            SuspendLayout();

            GroupSnapshots.SetBounds(
                GroupSnapshots.Left, GroupSnapshots.Top,
                GroupSnapshots.Width, newHeight
            );
            Activities.SetBounds(
                GroupSnapshots.Left, newTop, GroupSnapshots.Width, ps.Height
            );

            ResumeLayout(true);
        }
MainWindow