.NET Framework 类库
HwndHost 类

更新:2007 年 11 月

在 Windows Presentation Foundation (WPF) 内容中将 Win32 窗口作为元素承载。 

命名空间:  System.Windows.Interop
程序集:  PresentationFramework(在 PresentationFramework.dll 中)

语法

Visual Basic(声明)
<SecurityPermissionAttribute(SecurityAction.InheritanceDemand, Flags := SecurityPermissionFlag.UnmanagedCode)> _
Public MustInherit Class HwndHost _
    Inherits FrameworkElement _
    Implements IDisposable, IWin32Window, IKeyboardInputSink
Visual Basic (用法)
Dim instance As HwndHost
C#
[SecurityPermissionAttribute(SecurityAction.InheritanceDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
public abstract class HwndHost : FrameworkElement, 
    IDisposable, IWin32Window, IKeyboardInputSink
Visual C++
[SecurityPermissionAttribute(SecurityAction::InheritanceDemand, Flags = SecurityPermissionFlag::UnmanagedCode)]
public ref class HwndHost abstract : public FrameworkElement, 
    IDisposable, IWin32Window, IKeyboardInputSink
J#
/** @attribute SecurityPermissionAttribute(SecurityAction.InheritanceDemand, Flags = SecurityPermissionFlag.UnmanagedCode) */
public abstract class HwndHost extends FrameworkElement implements IDisposable, 
    IWin32Window, IKeyboardInputSink
JScript
public abstract class HwndHost extends FrameworkElement implements IDisposable, IWin32Window, IKeyboardInputSink
XAML
该类为抽象类;有关 XAML 中可用的派生的非抽象类,请参见 继承层次结构。
备注

若要承载 Win32 窗口,请创建一个从 HwndHost 派生的类。重写 BuildWindowCore 方法并将 Win32 窗口创建为传递到该方法的父窗口的子级。

重要说明:

尽管 HwndHost 派生自 FrameworkElement,但是,源自 FrameworkElement 和其他中间类(如 UIElement)的 HwndHost 的各种属性通常不会映射到可能的 Win32 等效项。而且,并不是所有的 FrameworkElement / UIElement 输入事件都跨交互操作边界传输。HwndHost 主要派生自 FrameworkElement,因此可以将 HwndHost 实例尽可能多地插入到内容模型中,以便应用默认的 FrameworkElement 布局特性。有关 HwndHost 的更多详细信息,请参见 WPF 和 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
另请参见

参考

其他资源

标记 :


Page view tracker