CEF Sharp Simple Example Blank Screen on Winforms

1,765 views
Skip to first unread message

Andrew Herrick

unread,
Oct 11, 2014, 5:51:37 AM10/11/14
to cefs...@googlegroups.com
I am using Windows 8.1 VS2013. I've added the CEF Winforms NuGet package and added a tool strip container that I'm appending the browser too.

However when I run the Winform it's just blank. No browser. Any thoughts on what is going on here? Too me it seems like I am just missing some setting perhaps.


Link to my VS2010 solution can be found here: http://andrewherrick.com/spike/cef.zip

Thank you!

Peter Shaw

unread,
Oct 20, 2014, 9:15:47 PM10/20/14
to cefs...@googlegroups.com
If you follow the instructions in the accepted answer on the SO post it will solve your issues, there is however a small caveat as I found out today debugging the same issue.

As well as the Cef.Initialize stuff in program.cs (See the simple winforms sample on github) and the newing up of the browser instance in the form.

You MUST make sure that you new the browser instance up inside the form constructor.  I don't know why this matters, but it does.

I found this out the hard way after spending several hours trying to figure out why I couldn't get a display, in my case I was actually trying to new the browser control and load the initial view from a button click handler.

Once I moved the newing up code from the button handler back into the forms Ctor everything was fine again.

This left me with a little predicament because I din't want the browser to load immediately, but I solved that by putting an empty string in the url parameter as a newed it, thus rendering nothing, then later just pointing it to the location I wanted to see.

Shawty

Reply all
Reply to author
Forward
0 new messages