www.mxdraw.com
内容索引主面
前一个向上下一个
_DMxDrawXEvents::SelectModified 方法

当前选择实体发生变化,会调用该事件

IDL
[id(22)]
void SelectModified(IDispatch* pAryId, IDispatch* pModifyId, VARIANT_BOOL isAdd);
参数 
说明 
IDispatch* pAryId 
当前被选择的实体lId,是一个实体lid链表。 
IDispatch* pModifyId 
本次发生变化的对象id数组 
VARIANT_BOOL isAdd 
aryModifyId的对象,是新加入到选择集,还是删除。 

例如: VC COM

            void CTestVc2005Dlg::SelectModifiedMxdrawxctrl1(LPDISPATCH pAryId,LPDISPATCH pModifyId,BOOL isAdd)
            {
                // TODO: 在此处添加消息处理程序代码

                IMxDrawResbufPtr spResbuf;
                pAryId->QueryInterface(&spResbuf);

                if(spResbuf==  NULL)
                    return;

                int iCount = spResbuf->Count;

                for(int i = 0; i < iCount;i++)
                {
                    // 得到当前,被选中的实体.
                    IMxDrawMcDbObjectPtr spObj = spResbuf->AtObject(i);
                    if(spObj == NULL)
                        continue;;
                }

            }

例如: js代码

        function CustomEvent(sEventName)
        {
                if(sEventName == "SelectModified")
               {
                        var axMxDrawX1 = document.getElementById("MxDrawXCtrl");
                        var pParam = axMxDrawX1.CustomEventParam();
                        var i = 0;
                        for(;i < pParam.Count;i++)
                        {
                              // 选择的实体对象id.
                              var id = pParam.AtLong(i);
                        }
                        alert(pParam.Count);
               }

        }

例如: C#代码

        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));

            }
        }
Copyright (c) 2010. All rights reserved.
你认为该帮助怎么样? 发送反馈信息!