[英]Reset cursor in App.xaml.cs, on DispatcherUnhandledException
当DispatcherUnhandledException事件发生时,是否有可能(如果可能)重置App.xaml.cs中的光标。
在发生意外情况后进行清理。
假设您的意思是鼠标光标,并且想要防止应用崩溃:
应用程式
<Application x:Class="WpfApplication1.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml"
DispatcherUnhandledException="Application_DispatcherUnhandledException">
<Application.Resources>
</Application.Resources>
</Application>
App.xaml.cs
private void Application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
// resets the cursor
Mouse.OverrideCursor = null;
// prevents the app from crashing
e.Handled = true;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.