如何获得visio形状顶点

时间:2009-12-08 02:03:14

标签: c#

我在我的c#项目visio activex中使用来导入visio平面图。我需要获取该绘图中的形状的顶点,我找不到任何方法或属性。如果有人有任何想法,请帮助。

2 个答案:

答案 0 :(得分:0)

This is something可能对您有所帮助。

以下是一些可以帮助您入门的代码段:

public void DrawSampleShapeConnection()
{
// get the current draw page
Visio.Page currentPage = axDrawingControl1.Document.Pages[1];

// Load the stencil we want
Visio.Document currentStencil = axDrawingControl1.Document.Application.Documents.OpenEx("Basic_U.vss", (short)Visio.VisOpenSaveArgs.visOpenDocked);

// show the stencil window
Visio.Window stencilWindow = currentPage.Document.OpenStencilWindow();

// this gives a count of all the stencils on the status bar
int countStencils = currentStencil.Masters.Count;

toolStripStatusLabel1.Text = string.Format("Number of Stencils in {0} = {1}", currentStencil.Title, countStencils);
statusStrip1.Refresh();

// create a triangle shape from the stencil master collection
Visio.Shape shape1 = currentPage.Drop(currentStencil.Masters["Triangle"], 1.50, 1.50);

// create a square shape from the stencil master collection
Visio.Shape shape2 = currentPage.Drop(currentStencil.Masters["Square"], 10, 7.50);

// create a dynamic connector from the stencil master collection
Visio.Shape connector = currentPage.Drop(currentStencil.Masters["Dynamic connector"], 4.50, 4.50);

// currentPage.Layout();

// connect the shapes together through the dynamic connector
ConnectShapes(shape1, shape2, connector);

}

答案 1 :(得分:0)

谢谢,你的代码让我发现了方法。 如果你想要一个形状的顶点s: s.pathes [1] .point(double tolarence,out array a); resuly将在一维数组a。