有哪位朋友能帮我把下面的VB代码改写成C#代码下,本人不懂VB哈 谢谢
Public Sub ToSheet_Example()
Dim vsoShapes As Visio.Shapes
Dim vsoShape As Visio.Shape
Dim vsoConnectTo As Visio.Shape
Dim vsoConnects As Visio.Connects
Dim vsoConnect As Visio.Connect
Dim intCurrentShapeIndex As Integer
Dim intCounter As Integer
Set vsoShapes = ActivePage.Shapes
'For each shape on the page, get its connections.
For intCurrentShapeIndex = 1 To vsoShapes.Count
Set vsoShape = vsoShapes(intCurrentShapeIndex)
Set vsoConnects = vsoShape.Connects
'For each connection, get the shape it connects to.
For intCounter = 1 To vsoConnects.Count
Set vsoConnect = vsoConnects(intCounter)
Set vsoConnectTo = vsoConnect.ToSheet
'Print the name of the shape the
'Connect object connects to.
Debug.Print vsoConnectTo.Name
Next intCounter
Next intCurrentShapeIndex
End Sub
------解决方案--------------------
C# code
void ToSheet_Example(){
Visio.Shapes vsoShapes;
Visio.Shape vsoShape;
Visio.Shape vsoConnectTo;
Visio.Connects vsoConnects;
Visio.Connect vsoConnect ;
int intCurrentShapeIndex;
int intCounter;
vsoShapes = ActivePage.Shapes;
//For each shape on the page, get its connections.
for(intCurrentShapeIndex = 1;intCurrentShapeIndex <=vsoShapes.Count;intCurrentShapeIndex ++)
{
vsoShape = vsoShapes(intCurrentShapeIndex) ;
vsoConnects = vsoShape.Connects ;
//For each connection, get the shape it connects to.
for(intCounter = 1; intCounter <=vsoConnects.Count ;intCounter ++)
{
vsoConnect = vsoConnects(intCounter) ;
vsoConnectTo = vsoConnect.ToSheet ;
//Print the name of the shape the
//Connect object connects to.
Console.WriteLine(vsoConnectTo.Name);
}
}
}