File tree Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -469,7 +469,7 @@ namespace CefSharp
469469 *(CefBrowserSettings*) browserSettings->_internalBrowserSettings , NULL );
470470 }
471471
472- void OnSizeChanged (IntPtr^ sourceHandle)
472+ void OnPaint (IntPtr^ sourceHandle)
473473 {
474474 HWND hWnd = static_cast <HWND>(sourceHandle->ToPointer ());
475475 RECT rect;
Original file line number Diff line number Diff line change @@ -55,10 +55,14 @@ public ChromiumWebBrowser(string address)
5555 {
5656 Cef . AddDisposable ( this ) ;
5757 Address = address ;
58+
59+ Paint += OnPaint ;
5860 }
5961
6062 protected override void Dispose ( bool disposing )
6163 {
64+ Paint -= OnPaint ;
65+
6266 Cef . RemoveDisposable ( this ) ;
6367
6468 if ( disposing )
@@ -137,15 +141,6 @@ protected override void OnHandleCreated(EventArgs e)
137141 managedCefBrowserAdapter . CreateBrowser ( BrowserSettings ?? new BrowserSettings ( ) , Handle , Address ) ;
138142 }
139143
140- protected override void OnSizeChanged ( EventArgs e )
141- {
142- base . OnSizeChanged ( e ) ;
143-
144- // Size is 0x0 when we are on a modeless Form which is minimized.
145- if ( ! Size . IsEmpty && managedCefBrowserAdapter != null )
146- managedCefBrowserAdapter . OnSizeChanged ( Handle ) ;
147- }
148-
149144 void IWebBrowserInternal . SetAddress ( string address )
150145 {
151146 Address = address ;
@@ -350,5 +345,14 @@ public Task<string> GetTextAsync()
350345 managedCefBrowserAdapter . GetText ( taskStringVisitor ) ;
351346 return taskStringVisitor . Task ;
352347 }
348+
349+ private void OnPaint ( object sender , PaintEventArgs e )
350+ {
351+ // Size is 0x0 when we are on a modeless Form which is minimized.
352+ if ( ! Size . IsEmpty && managedCefBrowserAdapter != null )
353+ {
354+ managedCefBrowserAdapter . OnPaint ( Handle ) ;
355+ }
356+ }
353357 }
354358}
You can’t perform that action at this time.
0 commit comments