有哪位朋友能帮我把下面的VB代码改写成C#代码下,本人不懂VB哈 谢谢

xianqf 2012-03-07 03:31:19
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


...全文
53 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
xnlm2005 2012-03-07
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 lihanbing 的回复:]
C# code

void ToSheet_Example(){

Visio.Shapes vsoShapes;
Visio.Shape vsoShape;
Visio.Shape vsoConnectTo;
Visio.Connects vsoConnects;
Visio.Connect vsoConnect ;
int intCurrentS……
[/Quote]
很对
xianqf 2012-03-07
  • 打赏
  • 举报
回复
vsoConnects(intCounter),vsoShapes(intCurrentShapeIndex)两处提示是变量但是当成了方法是用哈
lihanbing 2012-03-07
  • 打赏
  • 举报
回复

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);

}

}

}



bdmh 2012-03-07
  • 打赏
  • 举报
回复
一些变量的声明与赋值

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧