The namespace CefDemo. Bs
{
Public partial class BsCtl
{
CefBrowser bs;
Control the parent;
Public BsCtl (Control CTL, string url)
{
The parent=CTL;
Var cwi=CefWindowInfo. The Create ();
Cwi. SetAsChild (parent. Handle, new CefRectangle (0, 0, the parent. The Width, the parent, Height));
Var BC=new BsClient ();
BC. OnCreated +=bc_OnCreated;
Var bs=new CefBrowserSettings () {};
CefBrowserHost. CreateBrowser (cwi, BC, bs, url);
The parent. SizeChanged +=parent_SizeChanged;
}
Void bc_OnCreated (object sender, EventArgs e)
{
Bs=(CefBrowser) sender;
Var handle=bs. GetHost (.) GetWindowHandle ();
ResizeWindow (handle, the parent. The Width, the parent. Height);
}
Void parent_SizeChanged (object sender, EventArgs e)
{
If (bs!=null)
{
Var handle=bs. GetHost (.) GetWindowHandle ();
ResizeWindow (handle, the parent. The Width, the parent. Height);
}
}
Private void ResizeWindow (IntPtr handle, int width, int height)
{
If (handle!=IntPtr. Zero)
{
NativeMethod. SetWindowPos (handle, IntPtr. Zero,
0, 0, width, height,
0 x0002 | 0 x0004
);
}
}
Public void LoadUrl (string url)
{
Bs. GetMainFrame (.) LoadUrl (url);
}
}
}
CodePudding user response:
I also met the same problem, the solution genuflect is beggedCodePudding user response:
I also met the same problem, with o!!!!!!CodePudding user response:
Try changing the LIB, the code inside the package LIB700 40 M M website more LIB worksCodePudding user response:
static void Main ()
{
Try
{
//registered Log4
Log4net. Config. The XmlConfigurator. Configure ();
CefRuntime. The Load ();
Var mainArgs=new CefMainArgs (new string [] {});
Var exitCode=CefRuntime. ExecuteProcess (mainArgs, null);
If (exitCode!=1)
return;
Var Settings=new CefSettings
{
SingleProcess=false,
//MultiThreadedMessageLoop=true,
MultiThreadedMessageLoop=false,
LogSeverity=CefLogSeverity. Disable,
The Locale="useful - CN",
LogFile="CefGlue. Log",
};
CefRuntime. The Initialize (mainArgs, Settings, null);
Application. EnableVisualStyles ();
Application. SetCompatibleTextRenderingDefault (false);
if (! Settings. MultiThreadedMessageLoop)
{
Application. The Idle +=(sender, e)=& gt; {CefRuntime. DoMessageLoopWork (); };
}
Application. The Run (new FrmLogin ());
CefRuntime. Shutdown ();
}
The catch (Exception ex)
{
LogHelper. Error (" Main ", "Main", ex. Message);
}
}
Behind the MultiThreadedMessageLoop=false, change to be such, white is less, but still has a chance to get bad, at least can be used
CodePudding user response:
I also met the same problem, I download the latest version of cef3-76 is not the problem,