ry888 发表于 2008-2-19 09:54:00

如何写“通过点选获得封闭区域面积”的代码

<p>想用VB6如何实现以下的功能:</p><p>利用鼠标点选功能先获得对一个封闭区域的选择,然后获得该区域的面积。</p><p>谢谢</p>

azjmjsj 发表于 2008-2-19 20:25:00

<p>给你一段VBA代码,自己改到VB中</p><p>Public Sub FB_Area()<br/>&nbsp; Dim cecho As Variant<br/>&nbsp; cecho = ThisDrawing.GetVariable("cmdecho")<br/>&nbsp; ThisDrawing.SetVariable "cmdecho", 0<br/>&nbsp; Dim pt As Variant<br/>&nbsp; pt = ThisDrawing.Utility.GetPoint(, "点击封闭区域内部...")<br/>&nbsp; Dim spt As String<br/>&nbsp; spt = pt(0) &amp; "," &amp; pt(1)<br/>&nbsp; ThisDrawing.SendCommand Chr(3) &amp; Chr(3) &amp; "-boundary " &amp; spt &amp; " " &amp; " "<br/>&nbsp; ThisDrawing.SendCommand "draworder last&nbsp; f "<br/>&nbsp; ThisDrawing.SendCommand "_.area o last "<br/>&nbsp; ThisDrawing.SendCommand Chr(3) &amp; Chr(3)<br/>&nbsp; MsgBox vbCrLf &amp; "封闭区域面积为:" &amp; CStr(ThisDrawing.GetVariable("AREA"))<br/>&nbsp; ThisDrawing.SetVariable "CMDECHO", cecho<br/>&nbsp;End Sub</p>

ry888 发表于 2008-2-20 08:32:00

<p>谢谢</p>

sunny2008 发表于 2008-2-25 18:49:00

<p>谢谢 我先试试</p>
页: [1]
查看完整版本: 如何写“通过点选获得封闭区域面积”的代码