title: Break down form code behind WinForms
body: <p>In my latest WinForms Project, the code behind for my Main form has started to become too large and difficult to read. In other posts that I have read through, I have seen suggestions that say to create another class that is a partial class of your main form, however, what really bugs me is that the new class that you create automatically generates another blank design window. I'm really looking for a way to split my code behind into multiple partial classes but with only the one main design window.</p>
  
  <p>For example in the project below, my main Window is Form1.cs.</p>
  
  <p>When I first create the new class file (Form1Part2.cs), the file shows up as a c# class that does not contain its own form designer window. (Which is pretty much what I want except it needs to be connected to the Form1 Class, so I can access its controls and properties)</p>
  
  <p><a href="https://i.stack.imgur.com/xUtMz.png" rel="nofollow noreferrer">Before making class a partial class:</a></p>
  
  <p><a href="https://i.stack.imgur.com/xUtMz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xUtMz.png" alt=""></a></p>
  
  <p>However, when I make the new class a partial class of Form1, the file becomes a form containing a design window of its own.</p>
  
  <p><a href="https://i.stack.imgur.com/BHw1u.png" rel="nofollow noreferrer">After making class a partial class:</a></p>
  
  <p><a href="https://i.stack.imgur.com/BHw1u.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BHw1u.png" alt=""></a></p>