C#进行Visio二次开发之组合形状操作
2010-09-30 22:45:23 来源:WEB开发网本人实现了图形变化效果,截取项目部分代码,作为分析研究之用,如下所示:
else if (equipType == "4/2阀")
{
VisioUtility.SetGroupSelectMode(shape, 2);//改变模式,使之可以选择子形状
#region MyRegion
foreach (Shape subShape in shape.Shapes)
{
string subEquipType = VisioUtility.GetShapeCellValue(subShape, "设备类型");
if (subEquipType == "阀A" || subEquipType == "阀B")
{
subShape.Text = subEquipType;
if (intValue != 0)
{
continue;
}
try
{
VisWindow.DeselectAll();
VisWindow.Select(subShape, (short)VisSelectArgs.visSubSelect);
if (subEquipType == "阀A")
{
VisWindow.Selection.Move(0.393701, 0, "inches");//移动到右边
}
else if (subEquipType == "阀B")
{
VisWindow.Selection.Move(-0.393701, -0, "inches");//移动到左边
}
System.Windows.Forms.Application.DoEvents();
Thread.Sleep(50);
}
catch (Exception ex)
{
VisWindow.DeselectAll();
}
}
}
VisioUtility.SetGroupSelectMode(shape, 0);//还原选择模式,成为组合形状
#endregion
}
世界本简单,只因道未知;无师可自通,码界无秘密。
主要研究技术:代码生成工具、Visio二次开发、送水管理软件等共享软件开发
出处:http://www.iqidi.com
更多精彩
赞助商链接