title: Custom Class for dealing with embedding in Forms
body: <p>I have a custom class file in C# that I inherited and partially extended.  I am trying to <em>re factor</em> it now as I have just enough knowhow to know that with something like <em>generics</em>(I think) I could greatly condense this class.  </p>
  
  <p>As an inexperienced solo dev I would greatly appreciate any direction or constructive critism any can provide.  </p>
  
  <p>Don't be gentle!  I appreciate your time and have a blessed day!  I am preemptively sorry for the length.</p>
  
  <pre><code>using System.Windows.Forms;
  using DevExpress.XtraEditors;
  using DevExpress.XtraTab;
  
  namespace psWinForms
  {
      public static class WinFormCustomHandling
      {
          public static void ShowXFormInControl(Form frm, 
              ref XtraTabPage ctl, FormBorderStyle style)
          {
              frm.TopLevel = false;
              frm.ControlBox = false;
              frm.Parent = ctl;
              frm.FormBorderStyle = style;
              frm.Left = 0;
              frm.Top = 0;
              frm.Width = ctl.Width + 4;
              frm.Dock = DockStyle.Fill;
              frm.Show();
  
              //IMPORTANT: .Show() fires a form load event
              frm.BringToFront();
          }
  
          public static void ShowXFormInControl(Form frm, 
              ref XtraPanel ctl, FormBorderStyle style)
          {
              frm.TopLevel = false;
              frm.ControlBox = false;
              frm.Parent = ctl;
              frm.FormBorderStyle = style;
              frm.Left = 0;
              frm.Top = 0;
              frm.Width = ctl.Width + 4;
              frm.Dock = DockStyle.Fill;
              frm.Show();
              //IMPORTANT: .Show() fires a form load event
              frm.BringToFront();
  
          }
  
          public static void ShowXFormInControl(XtraForm Xfrm, 
              ref XtraTabPage ctl, FormBorderStyle style)
          {
              Xfrm.TopLevel = false;
              Xfrm.ControlBox = false;
              Xfrm.Parent = ctl;
              Xfrm.FormBorderStyle = style;
              Xfrm.Left = 0;
              Xfrm.Top = 0;
              Xfrm.Width = ctl.Width + 4;
              Xfrm.Dock = DockStyle.Fill;
              Xfrm.Show();
              //IMPORTANT: .Show() fires a form load event
              Xfrm.BringToFront();
  
          }
  
          public static void ShowXFormInControl(XtraForm Xfrm, 
              ref XtraPanel ctl, FormBorderStyle style)
          {
              Xfrm.TopLevel = false;
              Xfrm.ControlBox = false;
              Xfrm.Parent = ctl;
              Xfrm.FormBorderStyle = style;
              Xfrm.Left = 0;
              Xfrm.Top = 0;
              Xfrm.Width = ctl.Width + 4;
              Xfrm.Dock = DockStyle.Fill;
              Xfrm.Show();
              //IMPORTANT: .Show() fires a form load event
              Xfrm.BringToFront();
  
          }
  
          public static void ShowFormInControl(Form frm, 
              ref Panel ctl, FormBorderStyle style)
          {
              {
                  frm.TopLevel = false;
                  frm.ControlBox = false;
                  frm.Parent = ctl;
                  frm.FormBorderStyle = style;
                  frm.Left = 0;
                  frm.Top = 0;
                  frm.Width = ctl.Width + 4;
                  frm.Dock = DockStyle.Fill;
                  frm.Show();
                  //IMPORTANT: .Show() fires a form load event
                  frm.BringToFront();
              }
              //.SetBounds(ctl.Left, ctl.Top, ctl.Width, ctl.Height)
          }
          public static void ShowFormInControl(Form frm, 
              ref TabPage ctl, FormBorderStyle style)
          {
              {
                  frm.TopLevel = false;
                  frm.ControlBox = false;
                  frm.Parent = ctl;
                  frm.FormBorderStyle = style;
                  frm.Left = 0;
                  frm.Top = 0;
                  frm.Width = ctl.Width + 4;
                  frm.Dock = DockStyle.Fill;
                  frm.Show();
                  //IMPORTANT: .Show() fires a form load event
                  frm.BringToFront();
              }
          }
          public static void ShowFormInControl(Form frm, 
              Panel ctl, FormBorderStyle style, FormWindowState state)
          {
              {
                  frm.TopLevel = false;
                  frm.ControlBox = false;
                  frm.Parent = ctl;
                  frm.FormBorderStyle = style;
                  frm.Left = 0;
                  frm.Top = 0;
                  frm.Width = ctl.Width + 4;
                  frm.WindowState = state;
                  frm.Dock = DockStyle.Fill;
                  frm.Show();
                  //IMPORTANT: .Show() fires a form load event
                  frm.BringToFront();
              }
              //.SetBounds(ctl.Left, ctl.Top, ctl.Width, ctl.Height)
          }
          public static void ShowFormInControl(Form frm, 
              TabPage ctl, FormBorderStyle style, FormWindowState state)
          {
              {
                  frm.TopLevel = false;
                  frm.ControlBox = false;
                  frm.Parent = ctl;
                  frm.FormBorderStyle = style;
                  frm.Left = 0;
                  frm.Top = 0;
                  frm.Width = ctl.Width + 4;
                  frm.WindowState = state;
                  frm.Dock = DockStyle.Fill;
                  frm.Show();
                  //IMPORTANT: .Show() fires a form load event
                  frm.BringToFront();
              }
          }
          public static void ShowFormInControl(Form frm, 
              ref Panel ctl, FormBorderStyle style, int left, int top)
          {
              {
                  frm.TopLevel = false;
                  frm.ControlBox = false;
                  frm.Parent = ctl;
                  frm.FormBorderStyle = style;
                  frm.Left = left;
                  frm.Top = top;
                  frm.Width = ctl.Width + 4;
                  frm.Dock = DockStyle.Fill;
                  frm.Show();
                  //IMPORTANT: .Show() fires a form load event
                  //.Activate()
                  frm.BringToFront();
              }
              //.SetBounds(ctl.Left, ctl.Top, ctl.Width, ctl.Height)
          }
          public static void ShowFormInControl(Form frm, 
              ref TabPage ctl, FormBorderStyle style, int left, int top)
          {
              {
                  frm.TopLevel = false;
                  frm.ControlBox = false;
                  frm.Parent = ctl;
                  frm.FormBorderStyle = style;
                  frm.Left = left;
                  frm.Top = top;
                  frm.Width = ctl.Width + 4;
                  frm.Dock = DockStyle.Fill;
                  frm.Show();
                  //IMPORTANT: .Show() fires a form load event
                  //.Activate()
                  frm.BringToFront();
              }
          }
          public static void ShowFormInControl(Form frm, 
              Panel ctl, FormBorderStyle style, int left, int top, string title)
          {
              {
                  frm.TopLevel = false;
                  frm.ControlBox = false;
                  frm.Parent = ctl;
                  frm.FormBorderStyle = style;
                  frm.Left = left;
                  frm.Top = top;
                  frm.Width = ctl.Width + 4;
                  frm.Text = title;
                  frm.Dock = DockStyle.Fill;
                  frm.Show();
                  //IMPORTANT: .Show() fires a form load event
                  frm.BringToFront();
              }
              //.SetBounds(ctl.Left, ctl.Top, ctl.Width, ctl.Height)
          }
          public static void ShowFormInControl(Form frm, 
              TabPage ctl, FormBorderStyle style, int left, int top, string title)
          {
              {
                  frm.TopLevel = false;
                  frm.ControlBox = false;
                  frm.Parent = ctl;
                  frm.FormBorderStyle = style;
                  frm.Left = left;
                  frm.Top = top;
                  frm.Width = ctl.Width + 4;
                  frm.Text = title;
                  frm.Dock = DockStyle.Fill;
                  frm.Show();
                  //IMPORTANT: .Show() fires a form load event
                  frm.BringToFront();
              }
          }
      }
  }
  </code></pre>
  
  <hr>
  
  <p>I have the darnedest time posting code here and it turning out looking decent!</p>