我有以下代码:
var activeWindow = Application.ActiveWindow;
foreach (Visio.Shape shapeItem in activeWindow.Selection)
{
System.Windows.Forms.MessageBox.Show(shapeItem.Name);
if(shapeItem.SectionExists(visSectionConnectionPts, false) = false)
{
}
}我正在迭代一组形状并输出每个形状的名称。为了扩展这一点,我试图查看(对于每个选定的形状)节visSectionConnectionPts是否存在,因为我试图向当前选定的形状添加连接点。我有两个错误:
我如何进行上述工作?
发布于 2015-12-05 22:11:31
正如@Jelly所指出的那样,该方法返回一个简短的参数(在c#中),这两个参数也都很短。因此,您需要使用合格的枚举并将其转换为简短的内容:
if (shp.SectionExists[(short)Visio.VisSectionIndices.visSectionConnectionPts, 0] == 0)
{
shp.AddSection((short)Visio.VisSectionIndices.visSectionConnectionPts);
}https://stackoverflow.com/questions/33997026
复制相似问题