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)
就是这局不会呀
VBA代码转换为C#代码
答案:2 悬赏:20
解决时间 2021-03-11 21:44
- 提问者网友:醉归
- 2021-03-11 16:10
最佳答案
- 二级知识专家网友:一池湖水
- 2021-03-11 16:39
代码不全啊 很难理解
// 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()方法。 不知道能不能对应上。
全部回答
- 1楼网友:浪女动了心
- 2021-03-11 16:57
public object drawdot(double x1,double y1 ,double r )
{
bool dialogdisplay, drawflag;
double tempx, tempy, tempr;
tempx = ox + (x1 * 10) ;
tempy = oy - (y1 * 10) ;
tempr = r * 10;
dialogdisplay = false;
if((tempx - tempr < ox - lx / 2) || (tempx + tempr > ox + lx / 2) || (tempy - tempr < oy - ly / 2) || (tempy + tempr > oy + ly / 2))
{
dialogdisplay = true ;
messagebox.show("超出了边界!", "提示", messageboxbuttons.yesno, messageboxicon.information);
drawflag = false;
return ;
}
//不知道你用的是什么?
//set drawdot = activedocument.shapes.addshape(msoshapeoval, tempx - tempr, tempy - tempr, 2 * tempr, 2 * tempr)
//drawdot.fill.forecolor = rgb(0, 0, 0)
//drawflag = true
}
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯