void popupForm_CustomizeClientSize(object sender, CustomSizeEventArgs e)
        {
            e.CustomSize = new System.Drawing.Size(100, 182);

            Form form = (Form)sender;
            form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            e.Handled = true;
        }
 private void templateForm_CustomizeClientSize(object sender, CustomSizeEventArgs e)
 {
     int newHeight = e.CustomSize.Height;
     foreach (Control control in infoControls){
         newHeight += control.Size.Height;
     }
     e.CustomSize = new Size(e.CustomSize.Width, newHeight);
     e.Handled = true;
 }
        public void UpdateSize()
        {
            bottomPanel.MinimumSize = bottomPanel.MinSize;
            if (viewSitePanel.Controls.Count > 0)
            {
                Size viewControlMinimumSize = GetViewSitePanelMinSize();

                //int nonClientWidth = Size.Width - ClientSize.Width;
                //int nonClientHeight = Size.Height - ClientSize.Height;

                //int viewControlMinWidthWithPaddings = viewSitePanel.Padding.Left + viewSitePanel.Padding.Right + viewControlMinimumSize.Width;
                //int viewControlMinHeightWithPaddings = viewSitePanel.Padding.Top + viewSitePanel.Padding.Bottom + viewControlMinimumSize.Height;
                Size calculatedMinumumSize = new Size(Math.Max(viewControlMinimumSize.Width + viewSitePanel.Padding.Size.Width, initialMinimumSize.Width),
                        Math.Max(viewControlMinimumSize.Height + viewSitePanel.Padding.Size.Height + bottomPanel.MinSize.Height, initialMinimumSize.Height));
                if (CustomizeMinimumSize != null)
                {
                    CustomSizeEventArgs eventArgs = new CustomSizeEventArgs(calculatedMinumumSize);
                    CustomizeMinimumSize(this, eventArgs);
                    if (eventArgs.Handled)
                    {
                        calculatedMinumumSize = new Size(Math.Max(calculatedMinumumSize.Width, eventArgs.CustomSize.Width), Math.Max(calculatedMinumumSize.Height, eventArgs.CustomSize.Height));
                    }
                }
                MinimumSize = calculatedMinumumSize;

                if (AutoShrink && !IsSizeable)
                {
                    if (CustomizeClientSize != null)
                    {
                        CustomSizeEventArgs eventArgs = new CustomSizeEventArgs(calculatedMinumumSize);
                        CustomizeClientSize(this, eventArgs);
                        if (eventArgs.Handled)
                        {
                            calculatedMinumumSize = eventArgs.CustomSize;
                        }
                    }
                    if (WindowState == FormWindowState.Maximized)
                    {
                        ClientSize = new Size(
                            Math.Max(calculatedMinumumSize.Width, Size.Width),
                            Math.Max(calculatedMinumumSize.Height, Size.Height));
                    }
                    else
                    {
                        ClientSize = calculatedMinumumSize;
                    }
                }
            }
        }
 private void templateForm_CustomizeClientSize(object sender, CustomSizeEventArgs e)
 {
     int newHeight = e.CustomSize.Height + infoControls.Cast<Control>().Sum(control => control.Size.Height);
     e.CustomSize = new Size(e.CustomSize.Width, newHeight);
     e.Handled = true;
 }