学习vb.net二次开发例程
www.dimcax.com
学习vb.net二次开发例程
<commandmethod("getcircle")> public sub getcircle()
dim ed as editor = application.documentmanager.mdiactivedocument.editor
'创建一个选择实体的选择集选项,并限制为只能选择圆(使用了addallowedclass函数)
dim entityselectionopts as promptentityoptions = new promptentityoptions("\nselect circle")
entityselectionopts.setrejectmessage("\nonly circles may be selected.")
entityselectionopts.addallowedclass(gettype(circle), true)
'开始选择圆的过程
dim entityselectionresult as promptentityresult = ed.getentity(entityselectionopts)
'如果成功选择了一个圆,就在命令行显示圆的半径
if entityselectionresult.status = promptstatus.ok then
dispalycircleradius(entityselectionresult.objectid)
end if
end sub
private sub dispalycircleradius(byval circleid as objectid)
dim ed as editor = application.documentmanager.mdiactivedocument.editor
dim trans as transaction
trans = ed.document.transactionmanager.starttransaction
dim selectedcircle as circle = ctype(trans.getobject(circleid, openmode.forread), circle)
application.showalertdialog("选择的园半径为:" + selectedcircle.radius.tostring)
trans.commit()
end sub
编译的时候,红色标示部分总是提示类型不能转换,请问大家遇到过吗?该怎么解决呢?
已经解决,呵呵
是由于同一个解决方案中其它项目加载了
楼上的朋友。请问你是如何设置。net环境的?能否教教我?谢谢