* net-current-v30plus-md.md * net-current-v40plus-md.md * tla2sharptla-ui-md.md * tla2sharptla-uiautomation-md.md * tla2sharptla-winclient-md.md * tla2sharptla-xaml-md.md * tlasharptla-ui-md.md * tlasharptla-uiautomation-md.md * tlasharptla-winclient-md.md * tlasharptla-xaml-md.md * fix warnings
2.4 KiB
title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
| title | ms.date | dev_langs | helpviewer_keywords | ms.assetid | |||||
|---|---|---|---|---|---|---|---|---|---|
| How to: Hit Test Using a Win32 Host Container | 03/30/2017 |
|
|
9491f7f3-d8ba-4573-a888-2f064d1349dc |
How to: Hit Test Using a Win32 Host Container
You can create visual objects within a Win32 window by providing a host window container for the visual objects. To provide event handling for the contained visual objects you process the messages passed to the host window container’s message filter loop. Refer to Tutorial: Hosting Visual Objects in a Win32 Application for more information on how to host visual objects in a Win32 window.
Example
The following code shows how to set up mouse event handlers for a Win32 window that is used as a host container for visual objects.
[!code-csharpVisualsHitTesting#103] [!code-vbVisualsHitTesting#103]
The following example shows how to set up a hit test in response to trapping specific mouse events.
[!code-csharpVisualsHitTesting#104] [!code-vbVisualsHitTesting#104]
The xref:System.Windows.Interop.HwndSource object presents Windows Presentation Foundation (WPF) content within a Win32 window. The value of the xref:System.Windows.Interop.HwndSource.RootVisual%2A property of the xref:System.Windows.Interop.HwndSource object represents the top-most node in the visual tree hierarchy.
For the complete sample on hit testing objects using a Win32 host container, see Hit Test with Win32 Interoperation Sample.