Skip to content

Commit

Permalink
WinForms - Hide/Show internal browser when Visible change
Browse files Browse the repository at this point in the history
- ChromiumHostControl Add On OnVisibleChanged override
- ChromiumHostControl reorder OnSizeChanged so resize
  happens before event for consistency

Follow up to #2922
  • Loading branch information
amaitland committed Jun 5, 2021
1 parent e231bc7 commit 77aed48
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion CefSharp.WinForms/Host/ChromiumHostControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,24 @@ protected override bool IsInputKey(Keys keyData)
/// <param name="e">An <see cref="T:System.EventArgs" /> that contains the event data.</param>
protected override void OnSizeChanged(EventArgs e)
{
ResizeBrowser(Width, Height);

base.OnSizeChanged(e);
}

ResizeBrowser(Width, Height);
/// <inheritdoc />
protected override void OnVisibleChanged(EventArgs e)
{
if (Visible)
{
ShowInternal();
}
else
{
HideInternal();
}

base.OnVisibleChanged(e);
}

/// <summary>
Expand Down

0 comments on commit 77aed48

Please sign in to comment.