visio 画图
我第一次用代码画visio图形,不熟。想用代码在visio里画一个带有三个拐点的折线,但是画出来只有一个拐点,只有起止点跟第二个点,其他的都没有,请大侠指点。我的部分代码如下:
public void Line()
{
//long UndoScopeID2;
//UndoScopeID2 = visApplication.BeginUndoScope("手动编辑");
this.visApplication.Documents.OpenEx(@"F:\Data\Temp\绘图2.vsd", (short)Microsoft.Office.Interop.Visio.VisOpenSaveArgs.visOpenDocked + (short)Microsoft.Office.Interop.Visio.VisOpenSaveArgs.visOpenRO);
Master master = visApplication.Documents[@"F:\Data\Temp\绘图2.vsd"].Masters.get_ItemU("Dynamic connector");
// Master master = this.visApplication.ActiveDocument.Masters.get_ItemU("Dynamic connector");
Microsoft.Office.Interop.Visio.Shape connector = this.visApplication.ActivePage.Drop(master, 0.0, 0.0);
//TODO 坐标转换
//设置如果两条线相交错开
connector.get_CellsSRC((short)VisSectionIndices.visSectionObject, (short)VisRowIndices.visRowShapeLayout, (short)VisCellIndices.visSLOConFixedCode).FormulaForceU = "3";
//宽度
//connector.get_CellsSRC((short)VisSectionIndices.visSectionObject, (short)VisRowIndices.visRowXFormOut, (short)VisCellIndices.visXFormWidth).FormulaForceU = "GUARD(1.0433070866142)";
////高度
//connector.get_CellsSRC((short)VisSectionIndices.visSectionObject, (short)VisRowIndices.visRowXFormOut, (short)VisCellIndices.visXFormHeight).FormulaForceU = "GUARD(-0.80708661417323)";
//设置起始点X轴坐标位置
connector.get_CellsSRC((short)VisSectionIndices.visSectionObject, (short)VisRowIndices.visRowXForm1D, (short)VisCellIndices.vis1DBeginX).FormulaForceU = "75 mm";//"57 mm";
//设置起始点Y轴坐标位置
connector.get_CellsSRC((short)VisSectionIndices.visSectionObject, (short)VisRowIndices.visRowXForm1D, (short)VisCellIndices.vis1DBeginY).FormulaForceU = "140 mm";//"243.5 mm";
//设置终点X轴坐标位置
connector.get_CellsSRC((short)VisSectionIndices.visSectionObject, (short)VisRowIndices.visRowXForm1D, (short)VisCellIndices.vis1DEndX).FormulaForceU = "125 mm";//"83.5 mm";
//设置终点Y轴坐标位置
connector.get_CellsSRC((short)VisSectionIndices.visSectionObject, (short)VisRowIndices.visRowXForm1D, (short)VisCellIndices.vis1DEndY).FormulaForceU = "103.5 mm";//"213 mm";
//connector.get_CellsSRC((short)VisSectionIndices.visSectionObject, (short)VisRowIndices.visRowTextXForm, (short)VisCellIndices.visXFormPinX).FormulaForceU = "0.17339654204";
//connector.get_CellsSRC((short)VisSectionIndices.visSectionObject, (short)VisRowIndices.visRowTextXForm, (short)VisCellIndices.visXFormPinX).FormulaForceU = "-0.99737991956634";
//设置连接线
connector.get_CellsSRC((short)VisSectionIndices.visSectionFirstComponent, 1, 0).FormulaForceU = "0";
connector.get_CellsSRC((short)VisSectionIndices.visSectionFirstComponent, 1, 1).FormulaForceU = "0";
connector.get_CellsSRC((short)VisSectionIndices.visSectionFirstComponent, 2, 0).FormulaForceU = "0.59055118110236";
connector.get_CellsSRC((short)VisSectionIndices.visSectionFirstComponent, 2, 1).FormulaForceU = "-0.71850393700787";
connector.get_CellsSRC((short)VisSectionIndices.visSectionFirstComponent, 3, 0).FormulaForceU = "-8.8817841970013e-16";