CAD动态提示

1、控件具有鼠标停在一个对象上,然后自动弹出一个提示信息窗口的功能,效果如下:

stuat.png

 

2、参考例子:samples\ie\iedemoTest.htm,点击例子上边的设置超连接按钮,然后把鼠标停在对象上两秒,就能看到效果了。自动提示事件,用户响应该事件,返回需要显示的字符串,返回的字符串支持Html格式化。

COM接口_DMxDrawXEvents::InputPointToolTipEvent
设置提示时间_DMxDrawX::SetToolTipInitialTime
设置ToolTip自动提示隐藏时间_DMxDrawX::SetToolTipPopTime

3、JS例子说明:

(1) 增加InputPointToolTipEvent事件响应函数:

1

document.getElementById("MxDrawXCtrl").ImpInputPointToolTipFun = DoInputPointToolTipFun;

(2) 在事件中返回需要提示的字符串:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

function DoInputPointToolTipFun(ent) {

    var sHyperlinks = ent.Hyperlinks;

if(sHyperlinks.length != 0)

{

var sClassName = ent.ObjectName;

  

        var tip = "<b><ct=0x0000FF><al_c>"+sClassName+

           "</b><br><ct=0x00AA00><hr=100%></ct><br><a=\"link\">" + sHyperlinks + "</a>";

  

        mxOcx.SetEventRetString(tip);

    }

    ent = null;

    CollectGarbage();

}

C++接口McEdInputPointMonitor::MonitorInputPointToolTip
设置提示时间MxDraw::SetDynToolTipInitialTime
设置ToolTip自动提示隐藏时间MxDraw::SetDynToolTipPopTime

4、McEdInputPointMonitor::MonitorInputPointToolTip方法

(1)接口:

virtual Mcad::ErrorStatus MonitorInputPointToolTip(IN const McDbObjectIdArray& pickedEntities, IN const McGePoint3d& pickedPoint, IN CString& sNewToolTipString);

(2)参数:

参数说明
IN const McDbObjectIdArray& pickedEntities

当前光标下面的实体

IN const McGePoint3d& pickedPoint

光标位置

IN CString& sNewToolTipString  

返回提示信息字符串  

(3)参考例子:MxDraw5.2\samples\Edit\Edit.sln中InputPointMonitor.cpp文件。代码如下:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

Mcad::ErrorStatus CInputPointMonitor::MonitorInputPointToolTip(IN const McDbObjectIdArray& pickedEntities,

   IN const McGePoint3d& pickedPoint,

   IN CString& sNewToolTipString

   )

{

if(!pickedEntities.isEmpty())

{

AcDbObjectId entId = pickedEntities[0];

AcDbObjectPointer<AcDbEntity> spEnt(entId,AcDb::kForRead);

if(spEnt.openStatus() == Acad::eOk)

{

CString sClassName = spEnt->isA()->name();

  

AcDbHandle handle;

spEnt->getAcDbHandle(handle);

TCHAR szHandle[256];

handle.getIntoAsciiBuffer(szHandle);

  

CString sLayerName;

{

AcDbObjectPointer<AcDbLayerTableRecord> spLayerTableRec(spEnt->layerId(),AcDb::kForRead);

if(spLayerTableRec.openStatus() == Acad::eOk)

{

LPCTSTR pszLayerName = NULL;

spLayerTableRec->getName(pszLayerName);

sLayerName = pszLayerName;

}

}

  

sNewToolTipString.Format(_T("类名:%s,层名:%s,名柄:%s"),sClassName,sLayerName,szHandle);

}

}

return Mcad::eOk;

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值