没有边界cef winform

时间:2018-06-19 03:36:27

标签: winforms mouse cefsharp

问题

我需要调整大小没有边框形式,但是当ChromiumWebBrowser的底座填满时,CEF会吃掉与鼠标相关的信息,拖动表格会变得非常麻木。

我观察过谷歌Chrome,当鼠标外的表格可以拖动来改变表格的大小时,我怎样才能达到与谷歌Chrome相同的效果。

更新

我需要拖动来更改表单的大小,Draggable borderless window in CefSharp很多私有代码,我无法知道如何实现它。例如,cefsharp源中的ChromeWidgetMessageInterceptor.SetupLoop代码,ChromeWidgetMessageInterceptor没有SetupLoop。

Update2 添加屏幕截图和代码

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

0 个答案:

没有答案