客观的:
首先,我应该说我想做什么,然后我会在接下来的中描述我为实现我的目标做了什么。 (说明)部分。
我想创建一个 自定义列表母版形状 来自 普通容器功能区的“插入”选项卡中的“图表部件”部分。然后,我想创建 另一个主控形状 可以用作 的成员形状创建自定义列表母版形状 .
换句话说,我想添加 我创建的主控形状 至 我的自定义列表母版形状 喜欢附上 成员和分隔符主形状 到 类(class)大师造型的 UML 模板。
因此,我在实现我的目标时遇到了一些问题,我将在下一部分中对其进行描述。
说明:
我创建了一些 “Visio 模板 (.vssx)”中的新主形状 文件如下:
图 1 - 新创建的主控形状和使用过的主控形状
创建属性主控形状以用作对象主控形状中的成员形状,就像在 UML 模板的类主控形状中使用的成员主控形状一样。
图 2 - 类主形状及其初始成员
从 Member Master Shape 创建的 Property Master Shape 已更改如下:
图 3 - Property Master Shape 的“Shape Data”对话框
图4 - 属性母版形状的“数据图形”和“数据图形项”对话框
=MID(SUBSTITUTE(TRIM(SHAPETEXT(TheText)),"[",""),1,FIND(" ",SUBSTITUTE(TRIM(SHAPETEXT(TheText)),"[",""))-1)
代替:
=SHAPETEXT(TheText)
图 5 - 属性母版形状的“ShapeSheet”窗口
从普通容器创建的对象主形状已更改如下:
图 6 - 更改其内容后,ShapeSheet 窗口的用户定义单元格和事件部分中的单元格
代替:
图 7 - 在更改其内容之前,ShapeSheet 窗口的用户定义单元格和事件部分中的单元格
问题:
第一个问题:
为什么在将其/它们添加到对象主控形状的实例后,属性主控形状的实例没有/不是正确排列和放置,例如将成员主控形状的实例添加到UML 模板的类主形状的实例(图 8)?
图 8 - 将对象主控形状的实例和属性主控形状的一个实例与 UML 模板及其初始成员的类主控形状的实例进行比较
第二个问题:
为什么对象主形状的实例在将其/它们附加到页面后不添加其初始成员,就像在将 UML 模板的类主形状的实例添加到页面后添加初始成员一样页(图 9)?
图 9 - 将对象母版的实例与 UML 模板的类母版的实例进行比较
我添加了以下公式来实现这一目标;但是,我认为它不起作用:
=IF(LISTMEMBERCOUNT()=0,DOCMD(2270),0)
第三个问题:
为什么不在对象主控形状的实例中显示 Bar 以插入属性主控形状的实例,例如在 UML 模板的类主控形状的实例中显示 Bar 以插入其成员(图 10)?
图 10 - 将对象母版的实例与 UML 模板的类母版的实例进行比较,以显示 Bar 以插入相关成员
第四个问题:
为什么对象主控形状的实例接受所有主控形状的实例,除了属性主控形状的实例,而不是类主控形状的实例仅接受 UML 模板的成员和分隔符主形状的实例的 UML 模板(图 11)?
图 11 - 将接受所有主控形状实例的对象主控形状实例与仅接受成员和分隔符主控形状实例的 UML 模板的类主控形状实例进行比较UML 模板
我已经设置了
=USE("Property")
为 "User.msvSDListItemMaster"在 用户定义的单元格部分 ShapeSheet 窗口的;但是,我认为这是行不通的。第五问:
为什么不/不显示用于在属性主控形状的添加实例上插入成员到对象主控形状的实例的选项,如成员和分隔符主控形状的附加实例UML 模板到 UML 模板的类主形状的实例(图 12)?
图 12 - 将对象主控形状的实例和属性主控形状的一个实例与 UML 模板及其成员的类主控形状的实例进行比较,以在添加的成员上显示插入成员的选项
第 6 个(最终)问题:
当我将其/他们的主对象更改为列表时,为什么对象主形状的(一个或多个)实例表现得像容器?
最佳答案
第一个问题的答案:
这个问题总是因为不注意 “分类”单词。在大多数情况下,人们不会注意这个词并使用 《造型大师姓名》而不是 《形状分类》 ;然而,它们彼此不同。
就我而言,我被输入了形状大师名称 ( Property
) 为 User.msvSDContainerRequiredCategories
(以分号分隔的类别名称列表。其他形状必须至少有一个匹配名称才能被允许作为容器成员。)和 User.msvSDListRequiredCategories
(以分号分隔的类别名称列表。其他形状必须至少有一个匹配名称才能作为列表成员。)而不是形状类别 ( User.msvShapeCategories = Member
) .
图 1 - 比较“Shape Master Name”和“Shape Category”
第二个问题的答案:
为了解决这个问题,我们必须注意两点:
首先,我们必须在实例化主形状后添加我们想要自动添加的形状。因此,我们必须为每个想要添加名称的形状添加行 User.msvSDListItemMaster[Index]
(要为插入命令创建实例的主控形状的名称或 UniqueID。该值必须放在 USE() 函数内。)。
如您所见,我只想添加一种形状。所以,我必须改变User.msvSDListItemMaster
的名字行至 User.msvSDListItemMaster1
.如果我想在实例化时间内添加更多形状,我必须添加另一行,如 User.msvSDListItemMaster2
, User.msvSDListItemMaster3
等等。
其次,也是最后一件事,我们必须在 中添加一个公式。 "EventDrop" 的单元格《事件》部分。如您所见,我已将其添加到我的自定义列表形状中,如 here 中所述和 here :
Specifying an Insertion Shape
There are several ways to add a shape to a list: dragging and dropping the shape, clicking the blue insertion triangle that appears near the list edge, or right-clicking an existing member and inserting a shape. Clicking the insertion triangle and right-clicking to insert a shape both use the
User.msvSDListItemMaster
cell to determine what shape to add to the list. The name of the master is placed in quotes inside aUSE()
function (for example,USE("List member master")
). If no shape is specified in User.msvSDListItemMaster, Visio will duplicate an adjacent shape in the list when inserting the shape.It is also possible to automatically populate the list with some member shapes when the list is first dropped on the page. To do this, put the following formula in the EventDrop cell of the list, repeating the
DOCMD(2270)
once for each member to be added:
IF(LISTMEMBERCOUNT()=0,DOCMD(2270)+DOCMD(2270)+DOCMD(2270),0)
2270
is the command for inserting before an item in a list (visUiCmds.visCmdListInsertBefore
). It is also possible to use2271
, the command for inserting after an item in a list (visUiCmds.visCmdListInsertAfter
).
问题出在
2270
数字。 我不知道为什么它不起作用;但是,当我检查 中的上述单元格时《事件》 UML Stencil 的 Class Master Shape 部分,我看到有人用过 2499
而不是 2270
.所以,我在我的公式中使用了这个数字,它奏效了。如果我有多个形状用于 User.msvSDListItemMaster[Index]
行,我必须添加 +DOCMD(2499)
对于形状 1 之后的每个形状。第三个问题的答案:
如果第一个问题的问题解决了,这个问题就解决了。
第四个问题的答案:
如果第一个问题的问题解决了,这个问题就解决了。正如 here 中提到的和 here :
Controlling List Membership
Lists have their own cells to govern list membership. Use the
User.msvSDListRequiredCategories
andUser.msvSDListExcludedCategories
cells to restrict what shapes can become list members. Because lists are also containers, it is possible for shapes to become container members of the list. The standardUser.msvSDContainerRequiredCategories
andUser.msvSDContainerExcludedCategories
cells determine this behavior. By default, Visio will attempt to add a shape to a list as a list member, but if that fails it may try to add it as a container member. The difference between a list member and a container member is that only list members will be arranged by the list and affect its size. Shape designers should manage both sets of membership cells to ensure the right results.
我们最好同时使用
User.msvSDListRequiredCategories
和 User.msvSDContainerRequiredCategories
行获得最佳效率 .第五题答案:
如果第一个问题的问题解决了,这个问题就解决了。
第 6 个(最终)问题的答案:
答案是( here 和 here ):
Custom Lists
Any shape that has a value of
"List"
for theUser.msvStructureType
cell is treated by Visio as a list. A list orders and arranges its member shapes automatically. Note that lists are also considered to be containers, and they have similar capabilities such as automatically moving, copying, or deleting member shapes. All of the previously mentioned container cells apply to list shapes.Table 1. ShapeSheet container properties
User.msvSDContainerMargin
The distance between the container boundary and member shapes.
User.msvSDContainerResize
The automatic-resize behavior for the shape:
0 = No automatic resize.
1 = Expand as needed.
2 = Always fit to contents.
User.msvSDContainerStyle
A one-based index value for the current visual style of the container.
User.msvSDContainerStyleCount
The total number of visual styles that the container supports.
User.msvSDHeadingStyle
A one-based index value for the current visual style of the container heading.
User.msvSDHeadingStyleCount
The total number of visual styles that the container heading supports.
User.msvSDContainerLocked
A Boolean value that prevents membership changes in the container.
User.msvSDContainerRequiredCategories
A semicolon-delimited list of category names. Other shapes must have at least one matching name to be allowed as container members.
User.msvSDContainerExcludedCategories
A semicolon-delimited list of category names. Other shapes with at least one matching name are disallowed as container members.
User.msvSDContainerNoHighlight
A Boolean value that suppresses the container highlighting when member shapes are selected or added to the container.
User.msvSDContainerNoRibbon
A Boolean value that hides the Container Tools contextual tab in the ribbon for this container.
User.msvSDContainerHeadingEdge
A string that designates the location of the interior of the container from the perspective of the container heading. Must be "Left", "Right", "Top", or "Bottom".
User.msvSDMembersOnHiddenLayer
A Boolean value that determines whether Visio severs container relationships when the container or member is placed on a hidden layer. If True, Visio allows relationships to exist on the hidden layer. If False, Visio severs the relationships.
关于shape - 新创建的自定义列表形状在 Microsoft Visio 2013 x64 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28877699/