如何写“通过点选获得封闭区域面积”的代码
想用VB6如何实现以下的功能:利用鼠标点选功能先获得对一个封闭区域的选择,然后获得该区域的面积。
谢谢
给你一段VBA代码,自己改到VB中
Public Sub FB_Area()
Dim cecho As Variant
cecho = ThisDrawing.GetVariable("cmdecho")
ThisDrawing.SetVariable "cmdecho", 0
Dim pt As Variant
pt = ThisDrawing.Utility.GetPoint(, "点击封闭区域内部...")
Dim spt As String
spt = pt(0) & "," & pt(1)
ThisDrawing.SendCommand Chr(3) & Chr(3) & "-boundary " & spt & " " & " "
ThisDrawing.SendCommand "draworder lastf "
ThisDrawing.SendCommand "_.area o last "
ThisDrawing.SendCommand Chr(3) & Chr(3)
MsgBox vbCrLf & "封闭区域面积为:" & CStr(ThisDrawing.GetVariable("AREA"))
ThisDrawing.SetVariable "CMDECHO", cecho
End Sub
谢谢
谢谢 我先试试
页:
[1]