title: Borderless and Resizable Form (C#)
body: <p>I found some code online and copied it, so far I have been able to get everything right except for one thing which is I want to make the form (window) completely borderless.</p>
  
  <p>I'm using Visual Studio 2013 and this question is simply about the code that is needed to make the form (window) borderless. The problem is that when you make it borderless, it's no longer resizable but when it has a border, it can be resized.</p>
  
  <p>I know using some code it's possible to override and achieve both. This is what I have so far (copied from another website). This gets rid of the top bar which has the program name, makes the form movable by clicking and dragging the form, and it's resizable.</p>
  
  <p>Only problem is that the border is still there. What code can I add to this so the border will be gone? I want to keep this current code because it's serving a couple of features I need already.</p>
  
  <p>By the way, I looked at some older questions with similar topics but didn't find the right code I need.</p>
  
  <p><strong>For the mod who directed me to another thread:</strong> I tried the code there and it's not exactly what I'm trying to achieve although it's a similar problem. When I tried that code, I couldn't click anywhere on the form (window) to move it. Plus, it had one resizable corner at the bottom right which is not what I'm looking for. I need the resize function at all corners and sides just like a normal window.</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Windows.Forms;
  
  namespace BoxHider
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
              //Next line doesn't seem to be working
              this.FormBorderStyle = FormBorderStyle.None;
          }
          const int WM_NCHITTEST = 0x0084;
          const int HTCLIENT = 1;
          const int HTCAPTION = 2;
          protected override void WndProc(ref Message m)
          {
              base.WndProc(ref m);
              switch (m.Msg)
              {
                  case WM_NCHITTEST:
                      if (m.Result == (IntPtr)HTCLIENT)
                      {
                          m.Result = (IntPtr)HTCAPTION;
                      }
                      break;
              }
          }
          protected override CreateParams CreateParams
          {
              get
              {
                  CreateParams cp = base.CreateParams;
                  cp.Style |= 0x40000;
                  return cp;
              }
          }               
      }
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/9YNqv.jpg" alt="What I need"></p>