js中实现代码说明:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | function DoCloudCircleCommentFix() { var comment = mxOcx.NewEntity( "IMxDrawComment" ); comment.Text = "固定参数绘圆形云线标注" ; comment.TextHeight = 50; var frstPt = mxOcx.NewPoint(); frstPt.x = -200; frstPt.y = -200; var basepos = mxOcx.NewPoint(); basepos.x = 0; basepos.y = 10; var pos = mxOcx.NewPoint(); pos.x = 200; pos.y = 300; //基点 comment.BasePoint = basepos; //位置 comment.Position = pos; //标注位置提示多边形的半径 comment.ShapRadius = 50; //标注框类型 comment.BoundingBoxType = 5; //标注箭头类型 comment.ArrowType = 2; var points = mxOcx.NewComObject( "IMxDrawPoints" ); points.Add2(frstPt); points.Add2(basepos); //标注框坐标数据 comment.Bounding = points; var comobj = mxOcx.ObjectIdToObject(mxOcx.DrawEntity(comment)); comobj.TextStyle = "MyCommentFont" ; mxOcx.ZoomAll(); } |
效果展示:
通过点击绘制圆形云线标注按钮,触发DoCloudCircleCommentFix()事件,CAD控件视区将显示在js中设置好的圆形云线标注。如下图所示: