如何将合并(联合)形状分配给图层?
How can I assign the merged(union) shape to a layer?
我正在尝试将合并后的形状分配给新图层。我试图分配初始形状,但没有成功。到目前为止,这是我编码的一部分。
Dim vsoLayer As Visio.Layer
Dim vsoLayers As Visio.Layers
Set vsoLayers = ActivePage.Layers
Set vsoLayer = vsoLayers.Add("Layer1")
Dim vsoShapeA1 As Visio.shape
Set vsoShapeA1 = ActivePage.DrawRectangle(1, 5, 5, 1)
vsoShapeA1.Cells("Fillforegnd").Formula = "RGB(215,135,131)"
vsoShapeA1.BringToFront
Dim vsoShapeA2 As Visio.shape
Set vsoShapeA2 = ActivePage.DrawRectangle(2, 6, 6, 1)
vsoShapeA2.Cells("Fillforegnd").Formula = "RGB(215,135,131)"
vsoShapeA2.BringToFront
ActiveWindow.DeselectAll
vsoSelection.Select vsoShapeA1, visSelect
vsoSelection.Select vsoShapeA2, visSelect
vsoSelection.Union
vsoLayer.Add (?)......
然后我就无法将合并后的形状分配给图层。需要帮助。谢谢
合并将删除现有形状并创建新形状。新形状将是页面形状集合中的最新形状。您可以使用它来获取对新形状的引用并将其添加到图层中:
Set vsoNewShape = ActivePage.Shapes.Item(ActivePage.Shapes.Count)
vsoLayer.Add vsoNewShape, 0
我正在尝试将合并后的形状分配给新图层。我试图分配初始形状,但没有成功。到目前为止,这是我编码的一部分。
Dim vsoLayer As Visio.Layer
Dim vsoLayers As Visio.Layers
Set vsoLayers = ActivePage.Layers
Set vsoLayer = vsoLayers.Add("Layer1")
Dim vsoShapeA1 As Visio.shape
Set vsoShapeA1 = ActivePage.DrawRectangle(1, 5, 5, 1)
vsoShapeA1.Cells("Fillforegnd").Formula = "RGB(215,135,131)"
vsoShapeA1.BringToFront
Dim vsoShapeA2 As Visio.shape
Set vsoShapeA2 = ActivePage.DrawRectangle(2, 6, 6, 1)
vsoShapeA2.Cells("Fillforegnd").Formula = "RGB(215,135,131)"
vsoShapeA2.BringToFront
ActiveWindow.DeselectAll
vsoSelection.Select vsoShapeA1, visSelect
vsoSelection.Select vsoShapeA2, visSelect
vsoSelection.Union
vsoLayer.Add (?)......
然后我就无法将合并后的形状分配给图层。需要帮助。谢谢
合并将删除现有形状并创建新形状。新形状将是页面形状集合中的最新形状。您可以使用它来获取对新形状的引用并将其添加到图层中:
Set vsoNewShape = ActivePage.Shapes.Item(ActivePage.Shapes.Count)
vsoLayer.Add vsoNewShape, 0