
使用场景医疗场景在windows7触摸机器上更换原因长时间使用Chromium内核存在内存溢出的问题因WebView2内核也放弃了对windows7的更新 故使用的是109.0.1518.52离线版本内核离线内核使用//可以避免触摸滑动的页面滑动 这个找了好久 var options new CoreWebView2EnvironmentOptions(--disable-featuresElasticOverscroll); var webview2Path Path.Combine(AppDomain.CurrentDomain.BaseDirectory, WebView2, 109.0.1518.52); var environment await CoreWebView2Environment.CreateAsync(webview2Path, null, options); await webview2.EnsureCoreWebView2Async(environment); //禁用右键 webview2.CoreWebView2.ContextMenuRequested CoreWebView2_ContextMenuRequested; webview2.CoreWebView2.NewWindowRequested CoreWebView2_NewWindowRequested; webview2.CoreWebView2.Settings.AreDevToolsEnabled true; webview2.CoreWebView2.WebMessageReceived WebView_WebMessageReceived; // 确定是否可以从 WebView 中的页面访问主机对象。 webview2.CoreWebView2.Settings.AreDefaultContextMenusEnabled false; //确定用户是否能够影响 WebView 的缩放。 webview2.CoreWebView2.Settings.IsZoomControlEnabled false; //是否已启用捏合缩放 webview2.CoreWebView2.Settings.IsPinchZoomEnabled false; // 确定最终用户是否在支持触摸输入的设备上使用滑动手势在 WebView2 中导航。 webview2.CoreWebView2.Settings.IsSwipeNavigationEnabled false; //确定是否在 WebView 中向用户显示默认上下文菜单。 webview2.CoreWebView2.Settings.AreDefaultContextMenusEnabled false; //清理缓存 await webview2.CoreWebView2.Profile.ClearBrowsingDataAsync();windows7白屏问题WindowStyleNone ResizeModeCanMinimize 内核加载完URL再执行最大化 WindowState WindowState.Normal;以下不可使用 AllowsTransparencyTrue BackgroundTransparentwindows7不能触摸的问题public static void DisableWPFTabletSupport() { var devices Tablet.TabletDevices; if (devices.Count 0) { var inputManagerType typeof(InputManager); var stylusLogic inputManagerType.InvokeMember(StylusLogic, BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.NonPublic, null, InputManager.Current, null); if (stylusLogic ! null) { var stylusLogicType stylusLogic.GetType(); while (devices.Count 0) stylusLogicType.InvokeMember(OnTabletRemoved, BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.NonPublic, null, stylusLogic, new object[] { (uint)0 }); } } }