title: Draggable borderless window in CefSharp
body: <p>I want to implement borderless window with drag logic on some HTML element. I found some working examples (like <a href="https://chrome.google.com/webstore/detail/frameless-window-sample/hjjdaddngnaofnfjpajdcbdmkegiakec" rel="nofollow">frameless window for Chrome</a>) and this is what I've tried:</p>
  
  <pre><code>.title-area 
  {
     -webkit-app-region: drag;
  }
  
  &lt;div class='title-area'&gt;
      A draggable area
  &lt;/div&gt;
  </code></pre>
  
  <p>Then, in C# code I've implemented IDragHandler class:</p>
  
  <pre><code>internal class PromtDragHandler : IDragHandler
  {
      bool IDragHandler.OnDragEnter(IWebBrowser browserControl, IBrowser browser, IDragData dragData, DragOperationsMask mask)
      {
          return false;
      }
  
      void IDragHandler.OnDraggableRegionsChanged(IWebBrowser browserControl, IBrowser browser, IList&lt;DraggableRegion&gt; regions)
      {
  
      }
  }
  </code></pre>
  
  <p>Method OnDraggableRegionsChanged fires once at start, OnDragEnter fires when I'm dragging some text of the element "title-area". But I'm not sure what to do next to make my window move?</p>
  
  <p><strong>UPDATE.</strong> As mentioned in comments, <a href="https://bitbucket.org/chromiumembedded/cef/src/77746cfd1b863753ba05811cae89d2e79204cdb6/tests/cefclient/?at=master" rel="nofollow">CefTestApp</a> support this drag feature. In the source code we have method OnSetDraggableRegions which is called from DragHandler:</p>
  
  <pre><code>void RootWindowWin::OnSetDraggableRegions(
  const std::vector&lt;CefDraggableRegion&gt;&amp; regions) {
  REQUIRE_MAIN_THREAD();
  
  // Reset draggable region.
    ::SetRectRgn(draggable_region_, 0, 0, 0, 0);
  
    // Determine new draggable region.
    std::vector&lt;CefDraggableRegion&gt;::const_iterator it = regions.begin();
    for (;it != regions.end(); ++it) {
      HRGN region = ::CreateRectRgn(
          it-&gt;bounds.x, it-&gt;bounds.y,
          it-&gt;bounds.x + it-&gt;bounds.width,
          it-&gt;bounds.y + it-&gt;bounds.height);
      ::CombineRgn(
          draggable_region_, draggable_region_, region,
          it-&gt;draggable ? RGN_OR : RGN_DIFF);
      ::DeleteObject(region);
    }
  
    // Subclass child window procedures in order to do hit-testing.
    // This will be a no-op, if it is already subclassed.
    if (hwnd_) {
      WNDENUMPROC proc = !regions.empty() ?
          SubclassWindowsProc : UnSubclassWindowsProc;
      ::EnumChildWindows(
          hwnd_, proc, reinterpret_cast&lt;LPARAM&gt;(draggable_region_));
    }
  }
  </code></pre>
  
  <p>I'm still not quite understanding, how exactly information about dragable regions (which fires only once at start) helps to move window? Can someone explain me this logic or provide C# equivalent of this code?</p>