gotop 发表于 2007-5-31 16:47:00

请问如何把函数中绘制的一条多线段的名称传回来

<p>我调用了Draw_Box_Center绘制了一条多线段,我想在函数外中使用该多线段,比如说调用该多线段的的Coordinate属性。</p><p>我的代码如下,运行时出现“参数不可选”的错误提示</p><p>&nbsp;Call Draw_Box_Center("body_back_1", "Body_Layer", start_center_point_X, start_center_point_Y, L1, H1)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;Dim point1(0 To 1) As Double&nbsp;<br/>&nbsp;&nbsp;&nbsp; point1(0) = Draw_Box_Center.Coordinate(0)(0)<br/>&nbsp;&nbsp;&nbsp; point1(1) = Draw_Box_Center.Coordinate(0)(1)</p><p>Public Function Draw_Box_Center(box_name, layer_name, center_point_X, center_point_Y, box_long, box_width)<br/>' Define the 2D polyline points<br/>&nbsp;&nbsp;&nbsp; Dim first_point_X As Double<br/>&nbsp;&nbsp;&nbsp; Dim first_point_Y As Double<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; Dim points(0 To 9) As Double<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; first_point_X = center_point_X - box_long / 2<br/>&nbsp;&nbsp;&nbsp; first_point_Y = center_point_Y - box_width / 2<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; points(0) = first_point_X: points(1) = first_point_Y<br/>&nbsp;&nbsp;&nbsp; points(2) = first_point_X + box_long: points(3) = first_point_Y<br/>&nbsp;&nbsp;&nbsp; points(4) = first_point_X + box_long: points(5) = first_point_Y + box_width<br/>&nbsp;&nbsp;&nbsp; points(6) = first_point_X: points(7) = first_point_Y + box_width<br/>&nbsp;&nbsp;&nbsp; points(8) = first_point_X: points(9) = first_point_Y<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp; ' Create a lightweight Polyline object in model space<br/>&nbsp;&nbsp;&nbsp; Set box_name = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)</p><p><br/>&nbsp;&nbsp;&nbsp; Draw_Box_Center = box_name<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; ' Set the layer of new circle to "ABC"<br/>&nbsp;&nbsp;&nbsp; box_name.layer = layer_name</p><p>End Function</p>

sealive 发表于 2007-6-2 09:01:00

<p>Public Function Draw_Box_Center(box_name, layer_name, center_point_X, center_point_Y, box_long, box_width) as string</p><p>Draw_Box_Center=box_name.objecthandle</p><p>end function</p>

gotop 发表于 2007-6-2 12:00:00

sealive发表于2007-6-2 9:01:00static/image/common/back.gifPublic Function Draw_Box_Center(box_name, layer_name, center_point_X, center_point_Y, box_long, box_width) as stringDraw_Box_Center=box_name.objecthandleend function

<p>THANKS A LOT!!!</p><p>我用另一种方法实现了,</p><p>谢谢你的回答~~</p>
页: [1]
查看完整版本: 请问如何把函数中绘制的一条多线段的名称传回来