更新:2007 年 11 月
在 Windows Presentation Foundation (WPF) 内容中将 Win32 窗口作为元素承载。
命名空间:
System.Windows.Interop 程序集:
PresentationFramework(在 PresentationFramework.dll 中)
<SecurityPermissionAttribute(SecurityAction.InheritanceDemand, Flags := SecurityPermissionFlag.UnmanagedCode)> _
Public MustInherit Class HwndHost _
Inherits FrameworkElement _
Implements IDisposable, IWin32Window, IKeyboardInputSink
[SecurityPermissionAttribute(SecurityAction.InheritanceDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
public abstract class HwndHost : FrameworkElement,
IDisposable, IWin32Window, IKeyboardInputSink
[SecurityPermissionAttribute(SecurityAction::InheritanceDemand, Flags = SecurityPermissionFlag::UnmanagedCode)]
public ref class HwndHost abstract : public FrameworkElement,
IDisposable, IWin32Window, IKeyboardInputSink
/** @attribute SecurityPermissionAttribute(SecurityAction.InheritanceDemand, Flags = SecurityPermissionFlag.UnmanagedCode) */
public abstract class HwndHost extends FrameworkElement implements IDisposable,
IWin32Window, IKeyboardInputSink
public abstract class HwndHost extends FrameworkElement implements IDisposable, IWin32Window, IKeyboardInputSink
该类为抽象类;有关 XAML 中可用的派生的非抽象类,请参见 继承层次结构。
若要承载 Win32 窗口,请创建一个从 HwndHost 派生的类。重写 BuildWindowCore 方法并将 Win32 窗口创建为传递到该方法的父窗口的子级。
System..::.Object
System.Windows.Threading..::.DispatcherObject
System.Windows..::.DependencyObject
System.Windows.Media..::.Visual
System.Windows..::.UIElement
System.Windows..::.FrameworkElement
System.Windows.Interop..::.HwndHost
System.Windows.Forms.Integration..::.WindowsFormsHost
此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。但不保证所有实例成员都是线程安全的。
Windows Vista
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
.NET Framework
受以下版本支持:3.5、3.0
参考
其他资源