[英]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.