/// <summary> /// Handles the GotFocus event of the Form control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void Form_GotFocus(object sender, EventArgs e) { if (CefBrowser != null) { CefUtility.ExecuteTask(CefThreadId.UI, () => { CefBrowser.GetHost().SetFocus(true); }); } }
/// <summary> /// Handles the Move event of the Form control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void Form_Move(object sender, EventArgs e) { if (CefBrowser != null) { CefUtility.ExecuteTask(CefThreadId.UI, () => { CefBrowser.GetHost().NotifyMoveOrResizeStarted(); }); } }
/// <summary> /// Handles the Resize event of the Window control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void Window_Resize(object sender, EventArgs e) { if (CefBrowser != null) { CefUtility.ExecuteTask(CefThreadId.UI, () => { var display = NativeMethods.get_xdisplay(); if (Form.WindowState != FormWindowState.Minimized) { // resize the browser NativeMethods.XResizeWindow(display, CefBrowser.GetHost().GetWindowHandle(), (uint)Form.ClientSize.Width, (uint)Form.ClientSize.Height); } }); } }