c# - 使用 CefSharp 时屏幕闪烁
问题描述
public Notice() {
InitializeComponent();
AppDomain.CurrentDomain.AssemblyResolve += OnAssemblyResolve;
}
private Assembly OnAssemblyResolve(object sender, ResolveEventArgs args)
{
if (args.Name.StartsWith("CefSharp"))
{
string assemblyName = args.Name.Split(new[] { ',' }, 2)[0] + ".dll";
string architectureSpecificPath = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
Environment.Is64BitProcess ? "x64" : "x86",
assemblyName);
return File.Exists(architectureSpecificPath)
? Assembly.LoadFile(architectureSpecificPath)
: null;
}
return null;
}
private void InitChrome()
{
Cef.EnableHighDPISupport();
var settings = new CefSettings()
{
BrowserSubprocessPath = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
Environment.Is64BitProcess ? "x64" : "x86",
"CefSharp.BrowserSubprocess.exe")
};
if (!Cef.IsInitialized)
Cef.Initialize(settings);
chromeBrowser = new ChromiumWebBrowser(page);
chromeBrowser.RequestHandler = new CustomRequestHandler();
//chromeBrowser.IsBrowserInitializedChanged += ChromeBrowser_IsBrowserInitializedChanged;
this.Controls.Add(chromeBrowser);
chromeBrowser.Dock = DockStyle.Fill;
}
有一个父窗体和一个 mdi 子窗体。我以子形式使用 ChromiumWebBrowser。当鼠标指针位于父窗体上时,ChromiumWebBrowser 会一直闪烁。我该如何解决这个问题?
解决方案
推荐阅读
- c# - 相机不与播放器一起旋转 360 度视频录制中的播放器统一
- azure-cosmosdb - 即使 maxItemCount 设置为 -1,Cosmos Db 也不会返回所有记录
- javascript - 无法制作四种不同颜色的轮子
- office-js - Excel 加载项 | 根据条件启用/禁用功能区图标
- python - 如何在 FastApi 中隐藏输入参数?
- mongodb - Mongodb查询以检索月份范围内的数据
- python - 条件语句快捷方式(python)
- python - 如何从列表中获取多个输出
- cucumber - 带有 JUnit 5 的 Cucumber:未找到功能,未执行测试
- docker - Neo4j Docker:http-post 返回错误 EOF