Table of contents
TOC
折叠目录
展开目录

Page.InsertObject 方法 (Visio)Page.InsertObject Method (Visio)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

将新的嵌入对象或 ActiveX 控件添加到页面、主控形状或组中。Adds a new embedded object or ActiveX control to a page, master, or group.

语法Syntax

表达式InsertObject( ClassOrProgID标志)expression . InsertObject( ClassOrProgID , Flags )

表达式_一个表示一个Page对象的变量。_expression A variable that represents a Page object.

参数Parameters

名称Name必需/可选Required/Optional数据类型Data Type说明Description
ClassOrProgIDClassOrProgID必需RequiredStringString标识要创建的对象或控件的类型。Identifies the type of object or control to create.
FlagsFlags必需RequiredIntegerInteger影响操作的标志。Flags that influence the operation.

返回值Return Value

ShapeShape

注解Remarks

ClassOrProgID_是一个字符串,标识对象或要创建的控件的种类。它可以是对象或控件的类 ID (GUID) 的字符串或对象或控件的处理程序的类的程序 ID。_ClassOrProgID is a string that identifies the kind of object or control to create. It can be either the object or control's class ID (GUID) in string form or the object or control's program ID of the handler for the class.

  • 如果_ClassOrProgID_是一个表示类 ID 的字符串,其外观"{D3E34B21-9D75-101A-8C3D-00AA001A1652}。"If ClassOrProgID is a string representing a class ID, it looks like "{D3E34B21-9D75-101A-8C3D-00AA001A1652}."

  • 如果_ClassOrProgID_是一个表示程序 ID 的字符串,则它就像"paint.picture"或"forms.combobox.1"。If ClassOrProgID is a string representing a program ID, it looks like "paint.picture" or "forms.combobox.1".

请参阅特定供应商的文档或浏览注册表,以确定哪些类 ID 和程序 ID 与其他应用程序提供的对象和控件相关联。See vendor-specific documentation or browse the registry to determine which class IDs and program IDs are associated with objects and controls provided by other applications.

Flags_参数是一个位掩码,可以包含下列值之一。The _Flags argument is a bitmask that can include one of the following values.

* * 常 * *Constant *** * 值 * *Value *** * 说明 * *Description **
visInsertIconvisInsertIcon&;H 10&;H10将新建形状显示为图标。Displays the new shape as an icon.
visInsertDontShowvisInsertDontShow&;H1000&;H1000不执行新对象的显示动词。Does not execute the new object's show verb.

如果指定了visInsertIconvisInsertDontShowInsertObject方法将失败。如果您想要插入的对象显示为图标,则必须允许应用程序执行该对象的显示动词。If both visInsertIcon and visInsertDontShow are specified, the InsertObject method fails. If you want to insert an object that is displayed as an icon, you must allow the application to execute the object's show verb.

Flags_参数还可以包含下列值之一。The _Flags argument can also include one of the following values.

* * 常 * *Constant *** * 值 * *Value **
visInsertAsControlvisInsertAsControl&;H2000&;H2000
visInsertAsEmbedvisInsertAsEmbed&;H4000&;H4000

如果由_ClassOrProgID_标识的类别在注册表中被标识为可插入一个控件, visInsertAsControlvisInsertAsEmbed中的值才会起作用。如果该对象可以是控件或嵌入的对象visInsertAsControlvisInsertAsEmbed均未指定,应用程序会将其插入作为控件。Values in visInsertAsControl and visInsertAsEmbed only have an effect if the class identified by ClassOrProgID is identified in the registry as a control that can be inserted. If neither visInsertAsControl nor visInsertAsEmbed is specified and the object can be either a control or an embedded object, the application inserts it as a control.

在极少情况下,Visio 5.0 或更高版本可能会插入一个控件,而 Visio 的更早版本可能通过插入一个嵌入对象来响应同一调用。如果插入控件,则此方法将文档置于设计模式,从而导致在文档返回运行模式之前,文档中的任何代码执行都暂停。In rare cases, Visio 5.0 or later versions may insert a control whereas earlier versions of Visio would have responded to the same call by inserting an embedded object. If a control is inserted, this method places the document in design mode, causing any code executing in the document to halt until the document is returned to run mode.

安全ActiveX 控件添加到您的应用程序时,请格外小心。ActiveX 控件可能无法用其使用可能会带来安全风险的方式。我们建议使用从受信任的源的控件。对创作的任何控件进行签名。Security Use caution when you are adding ActiveX controls to your application. ActiveX controls may be designed in such a way that their use could pose a security risk. We recommend that you use controls from trusted sources only. Sign any controls you author.

警告: 是否通过注册表编辑器中或以编程方式修改注册表以任何方式,总会带来一定程度的风险。不正确的修改会导致严重的问题,可能需要您重新安装操作系统。最好总是计算机的注册表首先备份之前不对其进行修改。如果您运行的 Microsoft Windows NT 或 Microsoft Windows 2000,您还应该更新紧急修复磁盘 (ERD)。Caution Modifying the registry in any manner, whether through the Registry Editor or programmatically, always carries some degree of risk. Incorrect modification can cause serious problems that may require you to reinstall your operating system. It is a good practice to always back up a computer's registry first before modifying it. If you are running Microsoft Windows NT or Microsoft Windows 2000, you should also update your Emergency Repair Disk (ERD).

© 2018 Microsoft