WPF(Windows Presentation Foundation)는 Windows 7 터치 입력 처리를 기본으로 지원합니다. 지원은 OnStylusDown, OnStylusUp 및 OnStylusMove 이벤트로 태블릿 플랫폼의 실시간 스타일러스 입력을 통해 제공됩니다. Windows 7은 Win32 WM_TOUCH 창 메시지로 멀티 터치 입력도 제공합니다. 이러한 두 API는 동일한 HWND에서 함께 사용할 수 없습니다. 태블릿 플랫폼(WPF 애플리케이션의 기본값)을 통해 터치 입력을 활성화하면 WM_TOUCH 메시지가 비활성화됩니다. 따라서 WM_TOUCH를 사용하여 WPF 창에서 터치 메시지를 받으려면 WPF에서 기본 제공 스타일러스 지원을 비활성화해야 합니다. 이는 WM_TOUCH를 사용하는 구성 요소를 호스트하는 WPF 창과 같은 시나리오에 적용됩니다.
스타일러스 입력을 수신 대기하는 WPF를 비활성화하려면 WPF 창에서 추가된 태블릿 지원을 제거합니다.
예시
다음 샘플 코드는 리플렉션을 사용하여 기본 태블릿 플랫폼 지원을 제거하는 방법을 보여 줍니다.
public static void DisableWPFTabletSupport()
{
// Get a collection of the tablet devices for this window.
TabletDeviceCollection devices = System.Windows.Input.Tablet.TabletDevices;
if (devices.Count > 0)
{
// Get the Type of InputManager.
Type inputManagerType = typeof(System.Windows.Input.InputManager);
// Call the StylusLogic method on the InputManager.Current instance.
object stylusLogic = inputManagerType.InvokeMember("StylusLogic",
BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.NonPublic,
null, InputManager.Current, null);
if (stylusLogic != null)
{
// Get the type of the stylusLogic returned from the call to StylusLogic.
Type stylusLogicType = stylusLogic.GetType();
// Loop until there are no more devices to remove.
while (devices.Count > 0)
{
// Remove the first tablet device in the devices collection.
stylusLogicType.InvokeMember("OnTabletRemoved",
BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.NonPublic,
null, stylusLogic, new object[] { (uint)0 });
}
}
}
}
참고하십시오
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET Desktop feedback