版主,原代码如下:
Private Sub calcenpoint(ByRef coord1() As Double)'其参数为一多边形顶点坐标数组
Dim polygon As Variant
Dim jzx(0) As Object
Dim cen As Variant
Set jzx(0) = moSpace.AddLightWeightPolyline(coord1) '通过多边形数组增加多义线
polygon = moSpace.AddRegion(jzx) '通过多义线增加面域
cen = polygon(0).Centroid '求面域的质心
cenp(0) = cen(0): cenp(1) = cen(1)
jzx(0).Layer = "0"
polygon(0).Layer = "0"
polygon(0).Delete '删除多义线
jzx(0).Delete '删除面域
End Sub