WindowsCollection 接口

包含当前打开的每个 Microsoft InfoPath 窗口的 WindowObject 对象。

命名空间:  Microsoft.Office.Interop.InfoPath.SemiTrust
程序集:  Microsoft.Office.Interop.InfoPath.SemiTrust(位于 Microsoft.Office.Interop.InfoPath.SemiTrust.dll 中)

语法

声明
<GuidAttribute("096cd58b-0786-11d1-95fa-0080c78ee3bb")> _
Public Interface WindowsCollection _
    Inherits Windows
用法
Dim instance As WindowsCollection
[GuidAttribute("096cd58b-0786-11d1-95fa-0080c78ee3bb")]
public interface WindowsCollection : Windows

备注

此类型是用于 Coclass(托管代码需要此 Coclass 来实现 COM 互操作性)的包装。使用此类型来访问由此 Coclass 实现的 COM 接口。有关 COM 接口的信息(包括指向其成员说明的链接),请参阅Windows.

WindowObject 对象代表在 InfoPath 应用程序中使用的两种窗口类型:用户填写表单时用作表单区域的编辑窗口,以及用户设计表单时用作设计模式的设计窗口。

WindowsCollection 集合实现了可用于访问表单的相关 Window 对象的属性,它可以通过 Application 对象的 Windows 属性来访问。

备注

WindowsCollection 仅可用于获取其所包含的 WindowObject 对象的计数,或返回一个对指定 WindowObject 对象的引用。它不能用于创建、添加或删除 WindowObject 对象。

示例

在以下示例(实现为表单上按钮的 OnClick 事件处理程序)中,Application 对象的 Windows 属性用于设置对 WindowsCollection 集合的引用。后代码循环遍历该集合并显示在其中包含的每个 Window 对象的类型。

[InfoPathEventHandler(MatchPath="ShowWindowTypes", EventType=InfoPathEventType.OnClick)]
public void ShowWindowTypes_OnClick(DocActionEvent e)
{
// Set a reference to the Windows collection.
WindowsCollection windows = thisApplication.Windows;

// Loop through the collection and display the type
// of each Window object that it contains.
for (int i=0; i < windows.Count; i++)
 {
string windowType = "";

switch (windows[i].WindowType)
    {
    case XdWindowType.xdEditorWindow:
    windowType = "Editing window";
    break;

    case XdWindowType.xdDesignerWindow:
    windowType = "Designing window";
    break;
    }

thisXDocument.UI.Alert("Window type " + i + ": " + windowType);
 }
}

有关代码示例,请参阅如何:使用 InfoPath 2003 对象模型处理表单窗口

另请参阅

引用

WindowsCollection 成员

Microsoft.Office.Interop.InfoPath.SemiTrust 命名空间