找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 792|回复: 4

[求助]:请教xd:关于ToolTip?

[复制链接]
发表于 2002-3-8 03:33:46 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
上次从论坛上下载的是关于控件上的ToopTip,但是怎样当鼠标在绘图区移动时鼠标有ToolTip,就象在绘制一条直线时,当拖动直线的一点时会有ToolTip显示相关属性,我需要鼠标移动时就有这种效果,我想在您的代码上改,但是改不过来,怎样实现?谢谢!
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!

已领礼包: 145个

财富等级: 日进斗金

发表于 2002-3-8 03:38:56 | 显示全部楼层

Re: [求助]:请教xd:关于ToolTip?

最初由 梦宁 发布
[B]上次从论坛上下载的是关于控件上的ToopTip,但是怎样当鼠标在绘图区移动时鼠标有ToolTip,就象在绘制一条直线时,当拖动直线的一点时会有ToolTip显示相关属性,我需要鼠标移动时就有这种效果,我想在您的代码上改,?.. [/B]


下面资料是选中实体后,弹出TAG,标出实体的属性,可以定制自己的别ACAD LIST命令更方面的功能了。

梦宁你参照下,ARX的SAMPLE目录下,也有这类方面的代码。


How to display a tooltip for an Acad entity (AcDbEntity)?  
ID    17816  
Applies to:    AutoCAD 2000I
AutoCAD 2002
AutoCAD 2000


This document is part of    ObjectARX   MFC   User Interface     


Question
Most of the MFC toolbar buttons have associated tooltips that indicate what the
buttons are. Can I have tooltips for AutoCAD entities?
Answer
Yes. You can display the tooltip by using either using the CToolTipCtrl class provided by
MFC or the more simple *newer* method is to use the AcEdInputPointMonitor class.

CToolTipCtrl Method:

For displaying the entity type of an AutoCAD entity, for example, the same
class can be used in almost the same fashion.

The first task is to get the current mouse cursor position and translate that
into the AutoCAD WCS. This is handled by installing a mouse message hook,
acedRegisterFilterWinMsg() and using acedCoordFromPixelToWorld().

The second task is to select an entity under this translated mouse cursor
position and extract the entity information via its data structure. Because only
ads_nentselp() and ads_ssget() are suitable for the case, the task is handled by
traversing through the struct resbuf (a singly linked list).

The third task is to keep the content of the tooltip updated while the user
moves the mouse cursor from one entity to the other. There is also a timer that
needs to be set at 300 ms to display the tooltip within an appropriate period of
time.

The last task is to exclude the conflict between the tooltip display and the
AutoCAD command activities. Do this by planting an AcEdReactor so that there is
no tooltip displayed while a specific command activity is in action.

See the attached workspace and the project AutoTag.

AcEdInputPointMonitor

Using the ObjectARX Wizard Visual Studio plugin, create a new ObjectARX application.
Using the ObjectARX Wizard Visual Studio plugin toolbar, pick the Input Point
API Support button and create a new Input point monitor.
In the InitApplication() function, create a new instance of your newly created
Input Monitor.
Now edit the newly created Input Point Monitor class and add this code in the
monitorInput () - that's it!!




  1. // get the number of entities we've got
  2. int length = apertureEntities.length();
  3. // Check mouse aperture over some entity
  4. if (length)
  5. {
  6.   // open the entity for read
  7.   AcDbObjectPointer<AcDbEntity>ent (apertureEntities[0], AcDb::kForRead);
  8.   // if opened ok
  9.   if (ent.openStatus () == Acad::eOk)
  10.   {
  11.    // create a static string to return our string in
  12.    static char toolTip[133];
  13.    // now create our tooltip display value
  14.    strcpy (toolTip, ent->isA ()->name ());


  15.    // now tell autocad we have a tooltip for him
  16.    appendToTooltipStr = true;
  17.    // now set the tool tip string pointer
  18.    additionalTooltipString = toolTip;
  19.   }
  20. }   


  21. return Acad::eOk;

复制代码
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2004-9-25 20:45:57 | 显示全部楼层
请晓东讲一下
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2004-9-26 11:33:05 | 显示全部楼层

回复: 参考例子

参考:
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2004-10-6 16:01:55 | 显示全部楼层
请问如何控制鼠标偏离直线一定距离时仍然能够显示tooltip信息,恳请赐教!多谢!
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-9-22 03:36 , Processed in 0.352478 second(s), 40 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表