C# WPF着陆事件延迟
很简单,我在WPF4中的UserControl上接收着陆事件时遇到了无法接受的延迟。我对事件堆栈的理解是PreviewTouchDown首先被发送,但仍然需要大约300ms-500ms的时间。代码如下C# WPF着陆事件延迟,c#,.net,wpf,xaml,wpf-4.0,C#,.net,Wpf,Xaml,Wpf 4.0,很简单,我在WPF4中的UserControl上接收着陆事件时遇到了无法接受的延迟。我对事件堆栈的理解是PreviewTouchDown首先被发送,但仍然需要大约300ms-500ms的时间。代码如下 <UserControl x:Class="MyButton" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.micros
<UserControl x:Class="MyButton"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="300"
Stylus.IsPressAndHoldEnabled="False"
PreviewTouchDown="ProcessPreviewTouchDown"
PreviewTouchUp="ProcessPreviewTouchUp">
</UserControl>
这当然会删除UI,但不会导致速度明显提高,即使TABLET\u DISABLE\u PRESSANDHOLD本应如此,但我怀疑这与向XAML添加手写笔相同。IsPressAndHoldEnabled=False
如果有人对如何消除这种延迟有任何建议,我将不胜感激。您在哪里添加了这些代码?
num = GlobalAddAtom(atom);
if (num == 0L)
{
return false;
}
if (enable)
{
return (RemoveProp(hWnd, atom).ToInt64() == 1L);
}
else
{
int TABLET_DISABLE_PRESSANDHOLD = 0x00000001;
int TABLET_DISABLE_PENTAPFEEDBACK = 0x00000008;
int TABLET_DISABLE_PENBARRELFEEDBACK = 0x00000010;
int TABLET_DISABLE_TOUCHUIFORCEOFF = 0x00000200;
int TABLET_DISABLE_FLICKS = 0x00010000;
int dwHwndTabletProperty = 0x1010019 |
TABLET_DISABLE_PRESSANDHOLD |
TABLET_DISABLE_PENTAPFEEDBACK |
TABLET_DISABLE_TOUCHUIFORCEOFF |
TABLET_DISABLE_PENBARRELFEEDBACK |
TABLET_DISABLE_FLICKS;
return (SetProp(hWnd, atom, new IntPtr(dwHwndTabletProperty)) == 1);
}