C# Visio Addon - 遍历当前选择

C# Visio Addon - Iterate through current selection

我有以下代码:

        var currentSelection = activeWindow.Selection;

        if (currentSelection != null)
        {
            int numberOfShapes = currentSelection.Count;

            for( int i = 1; i <= numberOfShapes; i++)
            {

                currentSelection.Select(? ,Visio.VisSelectArgs.visSelect);
            }  
        }

如您所见,我正在 Visio 中循环选择形状。我在 Select 方法中与 SheetObject 参数作斗争。我想动态地实现它,所以我遍历所有形状(不管名称) - 最好的方法是什么?

迭代当前选择就像 Selection 集合上的 For Each 一样简单,例如:

Dim shp As Shape

For Each shp In ActiveWindow.Selection
    MsgBox shp.Name
Next