_XDocument2.ViewInfos 属性

定义

获取对 ViewInfosCollection 与窗体关联的集合的引用。

public:
 property Microsoft::Office::Interop::InfoPath::SemiTrust::ViewInfosCollection ^ ViewInfos { Microsoft::Office::Interop::InfoPath::SemiTrust::ViewInfosCollection ^ get(); };
public Microsoft.Office.Interop.InfoPath.SemiTrust.ViewInfosCollection ViewInfos { get; }
member this.ViewInfos : Microsoft.Office.Interop.InfoPath.SemiTrust.ViewInfosCollection
Public ReadOnly Property ViewInfos As ViewInfosCollection

属性值

实现

示例

在以下示例中, ViewInfos 对象的 属性 XDocument 用于设置对 ViewInfosCollection 集合的引用;然后,使用 CountViewInfosCollection 集合的 属性,它循环访问集合,以确定使用 IsDefaultViewInfoObject 对象的 属性的默认视图。 找到默认视图后,代码在消息框中显示该视图的名称。

<span class="label">ViewInfos</span> viewInfos;
viewInfos = thisXDocument.<span class="label">ViewInfos</span>;

for (int i=0; i &lt; viewInfos.Count; i++)
{
 if (viewInfos[i].IsDefault)
 {
  thisXDocument.UI.Alert("The default view is: " + viewInfos[i].Name);
 }
}

在以下示例中, ViewInfos 对象的 属性 XDocument 用于设置对 ViewInfosCollection 集合的引用;然后,使用 CountViewInfosCollection 集合的 属性,它循环访问集合,以确定使用 IsDefaultViewInfoObject 对象的 属性的默认视图。 找到默认视图后,代码在消息框中显示该视图的名称。

<span class="label">ViewInfos</span> viewInfos;
viewInfos = thisXDocument.<span class="label">ViewInfos</span>;

for (int i=0; i &lt; viewInfos.Count; i++)
{
 if (viewInfos[i].IsDefault)
 {
  thisXDocument.UI.Alert("The default view is: " + viewInfos[i].Name);
 }
}

注解

ViewInfos 集合包含对象的集合,ViewInfoObject其中包含有关 InfoPath 表单中实现的每个视图的信息。

重要提示:此成员只能由与当前打开的窗体在同一域中运行的表单访问,或者由已授予跨域权限的表单访问。

适用于