text: // 动态绘制批注函数.
  function DyDoComment3() {
      //清空当前显示内容
      mxOcx.NewFile();
      var getPt = mxOcx.NewComObject("IMxDrawUiPrPoint");
      getPt.message = "点取第一点";
      if (getPt.go() != 1) {
          return;
      }
      var frstPt = getPt.value();
      if (frstPt == null)
          return;
      var utl = mxOcx.NewUtility();
      var secondPt = utl.GetCorner(frstPt, "点取第二点");
      if (secondPt == null)
          return;
      var param = mxOcx.NewResbuf();
      param.AddString("");
      param.AddDouble(200);
      var ret = mxOcx.CallEx("Mx_ShowMTextDialog", param);
      if (ret.AtString(0) != "Ok")
      {
          return;
      }
      var txt = ret.AtString(1);
      var txtH = ret.AtDouble(2);
      var txtColorIndex = ret.AtLong(3);
      // 加入换行操作符\\P
      //txt = txt + "\\PTEST";
      // 创建一个文字样式,用于批注文字字体.
      mxOcx.AddTextStyle2("MyCommentFont", "黑体", 0.7);
      // 创建一个与用户交互取点的对象。
      var getSecondPt = mxOcx.NewComObject("IMxDrawUiPrPoint");
      getSecondPt.message = "输入标注位置点";
      getSecondPt.basePoint = secondPt;
      getSecondPt.setUseBasePt(false);
      spDrawData = getSecondPt.InitUserDraw("DrawComment2");
      // 设置动态绘制参数.
      spDrawData.SetPoint("BasePoint", secondPt);
      spDrawData.SetString("Text", txt);
      spDrawData.SetDouble("TextHeight", txtH);
      spDrawData.SetLong("EdgeNumber", 2);
      spDrawData.SetDouble("ShapRadius", 1);
  
      // 开始取第二个点。
      if (getSecondPt.go() != 1)
          return;
      var ent = mxOcx.DrawCustomEntity("TestMxCustomEntity1", "");
      ent.SetPoint("BasePoint", secondPt);
      ent.SetString("Text", txt);
      ent.SetDouble("TextHeight", txtH);
      ent.SetLong("EdgeNumber", 2);
      ent.SetDouble("ShapRadius", 1);
      ent.SetPoint("DimPoint", getSecondPt.value());
      ent.SetPoint("First", frstPt);
      ent.TextStyle = "MyCommentFont";
      ent.colorIndex = txtColorIndex;
  }
  