private void SetControlSize(Control control)
 {
     var ok = false;
     if (panelMain.Controls.Count > 0)
     {
         try
         {
             if (control == null)
             {
                 control = panelMain.Controls[0];
                 control.SuspendDrawing();
                 ok = true;
             }
             var width = panelMain.Width - 4;
             var height = panelMain.Height - 26;
             control.Width = width < ControlMinWidth ? ControlMinWidth : width;
             control.Height = height < ControlMinHeight ? ControlMinHeight : height;
         }
         finally
         {
             if (ok)
             {
                 control.ResumeDrawing();
             }
         }
     }
 }