VBA代码转换为C#代码
DimarrayPoints(1To7,1To2)AsSinglearrayPoints(1,1)=sourceXarrayPoints(1,2)=sourceYarra...
Dim arrayPoints(1 To 7, 1 To 2) As Single
arrayPoints(1, 1) = sourceX
arrayPoints(1, 2) = sourceY
arrayPoints(2, 1) = sourceX
arrayPoints(2, 2) = sourceY
arrayPoints(3, 1) = nodeX - (targetX - sourceX) / 4
arrayPoints(3, 2) = nodeY - (targetY - sourceY) / 4
arrayPoints(4, 1) = nodeX
arrayPoints(4, 2) = nodeY
arrayPoints(5, 1) = nodeX + (targetX - sourceX) / 4
arrayPoints(5, 2) = nodeY + (targetY - sourceY) / 4
arrayPoints(6, 1) = targetX
arrayPoints(6, 2) = targetY
arrayPoints(7, 1) = targetX
arrayPoints(7, 2) = targetY
Set myLine = myDoc.Shapes.AddCurve(arrayPoints, myAnchor)
Set myLine = myDoc.Shapes.AddCurve(arrayPoints, myAnchor)
就是这局不会呀 展开
arrayPoints(1, 1) = sourceX
arrayPoints(1, 2) = sourceY
arrayPoints(2, 1) = sourceX
arrayPoints(2, 2) = sourceY
arrayPoints(3, 1) = nodeX - (targetX - sourceX) / 4
arrayPoints(3, 2) = nodeY - (targetY - sourceY) / 4
arrayPoints(4, 1) = nodeX
arrayPoints(4, 2) = nodeY
arrayPoints(5, 1) = nodeX + (targetX - sourceX) / 4
arrayPoints(5, 2) = nodeY + (targetY - sourceY) / 4
arrayPoints(6, 1) = targetX
arrayPoints(6, 2) = targetY
arrayPoints(7, 1) = targetX
arrayPoints(7, 2) = targetY
Set myLine = myDoc.Shapes.AddCurve(arrayPoints, myAnchor)
Set myLine = myDoc.Shapes.AddCurve(arrayPoints, myAnchor)
就是这局不会呀 展开
1个回答
展开全部
代码不全啊 很难理解
// float和Single小数点位数也有点对不上
float arrayPoints = new float[7][2];
arrayPoints [0][0] = sourceX;
arrayPoints[0][1] = SourceY;
arrayPoints[1][0] = sourceX;
arrayPoints[1][1] = SourceY;
arrayPoints[1][1] = SourceY;
arrayPoints[2][0] = nodeX - (targetX - sourceX)/4;
arrayPoints[2][1] = nodeY - (targetY - sourceY) / 4
arrayPoints[3][0] = nodeX ;
arrayPoints[3][1] = nodeY ;
arrayPoints[4][0] = nodeX + (targetX - sourceX) / 4 ;
arrayPoints[4][1] = nodeY + (targetY - sourceY) / 4 ;
arrayPoints[5][0] = targetX ;
arrayPoints[5][1] = targetY ;
arrayPoints[6][0] = targetX ;
arrayPoints[6][1] = targetY ;
// 最后一句话像是画图形?画线段?对应的C#好像没见过这方法
但是有个G.DrawRectangle()方法。 不知道能不能对应上。
// float和Single小数点位数也有点对不上
float arrayPoints = new float[7][2];
arrayPoints [0][0] = sourceX;
arrayPoints[0][1] = SourceY;
arrayPoints[1][0] = sourceX;
arrayPoints[1][1] = SourceY;
arrayPoints[1][1] = SourceY;
arrayPoints[2][0] = nodeX - (targetX - sourceX)/4;
arrayPoints[2][1] = nodeY - (targetY - sourceY) / 4
arrayPoints[3][0] = nodeX ;
arrayPoints[3][1] = nodeY ;
arrayPoints[4][0] = nodeX + (targetX - sourceX) / 4 ;
arrayPoints[4][1] = nodeY + (targetY - sourceY) / 4 ;
arrayPoints[5][0] = targetX ;
arrayPoints[5][1] = targetY ;
arrayPoints[6][0] = targetX ;
arrayPoints[6][1] = targetY ;
// 最后一句话像是画图形?画线段?对应的C#好像没见过这方法
但是有个G.DrawRectangle()方法。 不知道能不能对应上。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询