//绘制矩形框 function DrawPathToPolyline() { // 创建一个与用户交互取点的对象。 var point1 = mxOcx.GetPoint(false,0,0,"\n 点取开始点:"); if(point1 == null) { return; } var getSecondPt = mxOcx.NewComObject("IMxDrawUiPrPoint"); getSecondPt.message = "第二点"; getSecondPt.basePoint = point1; //不开启皮筋效果 getSecondPt.setUseBasePt(false); //调用 var spDrawData = getSecondPt.InitUserDraw("TestDynDrawMatrix1"); // 设置动态绘制参数. spDrawData.SetPoint("BasePoint", point1); // 开始取第二个点。 if (getSecondPt.go() != 1) return; mxOcx.PathMoveTo(point1.x, point1.y); mxOcx.PathLineTo(point1.x, getSecondPt.value().y); mxOcx.PathLineTo(getSecondPt.value().x, getSecondPt.value().y); mxOcx.PathLineTo(getSecondPt.value().x, point1.y); mxOcx.PathMakeClosed(); mxOcx.DrawPathToPolyline(); } |