CAD当前选择实体发生变化调用事件(com接口)
作者:互联网
主要用到函数说明:
_DMxDrawXEvents::SelectModified
当前选择实体发生变化,会调用该事件,详细说明如下:
参数 | 说明 |
---|---|
IDispatch* pAryId |
当前被选择的实体lId,是一个实体lid链表 |
IDispatch* pModifyId |
本次发生变化的对象id数组 |
VARIANT_BOOL isAdd |
aryModifyId的对象,是新加入到选择集,还是删除 |
c#代码实现如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
private void axMxDrawX1_SelectModified(object sender, AxMxDrawXLib._DMxDrawXEvents_SelectModifiedEvent e)
{
MxDrawResbuf aryId = (MxDrawResbuf)e.pAryId;
int iCount = aryId.Count;
for (int i = 0; i < iCount; i++)
{
// 得到当前,被选中的实体.
Int64 id = aryId.AtObjectId(i);
}
// 得到选择时的,鼠标坐标点.
MxDrawResbuf param = (MxDrawResbuf)axMxDrawX1.CustomEventParam();
if (param.Count >= 2)
{
MxDrawPoint pt1 = param.AtPoint(0);
MxDrawPoint pt2 = param.AtPoint(1);
MessageBox.Show(String.Format( "pt1:{0:N3},{1:N3},pt2:{2:N3},{3:N3}" , pt1.x, pt1.y, pt2.x, pt2.y));
}
}
|
标签:aryId,param,MxDrawResbuf,接口,N3,com,pt2,pt1,CAD 来源: https://www.cnblogs.com/yzy0224/p/11002288.html