Files
docs-desktop/dotnet-desktop-guide/framework/wpf/graphics-multimedia/how-to-hit-test-using-a-win32-host-container.md
T
Andy De George da363692ff Initial WPF content migrated (#17)
* Reset branch for WPF changes

* Convert BMP to PNG; fix link-out-of-scope err

* Add snippets for WPF... 6794 files!!!!

* Add missing snippets

* update file updated between migration

* Fix paths to include

* update breadcrumb and toc

* fix index links

* fix index links

* fix index links

* fix markdown
2020-09-04 09:46:28 -07:00

2.4 KiB
Raw Blame History

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
csharp
vb
hit tests [WPF], using Win32 host containers
visual objects [WPF], hit tests on
Win32 host containers [WPF], hit tests using
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 containers 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 [!INCLUDETLA#tla_winclient] 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.

See also