0

Problem

I need to resize no border form,But when ChromiumWebBrowser's dock is fill, CEF will eat mouse related information, dragging the form becomes very insensitive.

I observed Google Chrome, when the mouse outside the form can be dragged to change the size of the form, how can I achieve the same effect as Google Chrome.

Update

I need drag to change form's size,and Draggable borderless window in CefSharp a lot of private code, I can't know how to implement it.for example, ChromeWidgetMessageInterceptor.SetupLoop,in the cefsharp source code, ChromeWidgetMessageInterceptor does not have SetupLoop.

Update2 Add the screenshot and the code

const int WM_MOUSEMOVE = 0x0200;
const int WM_MOUSELEAVE = 0x02A3;
const int WM_LBUTTONDOWN = 0x0201;
//
switch (message.Msg)
{
    case WM_MOUSEMOVE:
        var clientCursorPos = GetMousePoint(MousePosition);
        var newE = new MouseEventArgs(MouseButtons.None, 0, clientCursorPos.X, clientCursorPos.Y, 0);
        this.InvokeOnParent(delegate { this.OnMouseMove(newE); });
        break;
    case WM_LBUTTONDOWN:
        if (Cursor != Cursors.Default)
        {
            //this.InvokeOnParent(delegate { this.ResizeForm(this.ResizeDir); });
            this.InvokeOnParent(delegate
            {
                if (DesignMode) return;
                var dir = -1;
                switch (this.ResizeDir)
                {
                    case ResizeDirection.BottomLeft:
                        dir = HTBOTTOMLEFT;
                        break;
                    case ResizeDirection.Left:
                        dir = HTLEFT;
                        break;
                    case ResizeDirection.Right:
                        dir = HTRIGHT;
                        break;
                    case ResizeDirection.BottomRight:
                        dir = HTBOTTOMRIGHT;
                        break;
                    case ResizeDirection.Bottom:
                        dir = HTBOTTOM;
                        break;
                }

                ReleaseCapture();
                if (dir != -1)
                {
                    SendMessage(Handle, WM_NCLBUTTONDOWN, dir, 0);
                }
            });
        }
        break;
    case WM_MOUSELEAVE:
        Console.WriteLine("WM_MOUSELEAVE");
        break;
}

Mouse drag to change the size of the problem

Mouse drag to change the size of the problem

aduguid
  • 3,099
  • 6
  • 18
  • 37
  • 1
    Possible duplicate of [Draggable borderless window in CefSharp](https://stackoverflow.com/questions/36053892/draggable-borderless-window-in-cefsharp) – amaitland Jun 19 '18 at 05:20
  • Just search the source to see how it's used see https://github.com/cefsharp/CefSharp/blob/c37dbcd06a978ac000fdee14ac64df5b802eb2df/CefSharp.WinForms.Example/BrowserTabUserControl.cs#L234 – amaitland Jun 19 '18 at 08:40
  • @amaitland,I saw how to try ChromeWidgetMessageInterceptor,and it implements it in my own code.But there's another problem,When I dragged the form with my mouse , the mouse was still responding to browser control. Can I tell that browser controlbu does not respond to dragging changes in size? – JokerSTACKOVERFLOW Jun 20 '18 at 10:42
  • I have no idea what you mean – amaitland Jun 20 '18 at 20:01
  • @amaitland,I added the screenshot and the code – JokerSTACKOVERFLOW Jun 21 '18 at 05:30
  • I've never implemented resize. You can search http://magpcss.org/ceforum/index.php to see if someone else has – amaitland Jun 22 '18 at 07:57

0 Answers0