找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 1926|回复: 1

[教学]:使用ARX修改ACAD的光标

[复制链接]

已领礼包: 145个

财富等级: 日进斗金

发表于 2002-3-6 06:27:25 | 显示全部楼层 |阅读模式

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

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

×

  1. Setting the cursor in AutoCAD  
  2. ID    1731  
  3. Applies to:    AutoCAD 2000
  4. AutoCAD 2000I
  5. AutoCAD 2002

  6. Date    1/25/2002  

  7. This document is part of    User Interface     


  8. Question
  9. I am setting the Windows cursor to IDC_WAIT before performing a time-consuming
  10. operation in AutoCAD. However, AutoCAD resets the cursor every time the mouse
  11. moves. Can I prevent AutoCAD from changing the current cursor?
  12. Answer
  13. AutoCAD resets the cursor on each WM_MOUSEMOVE message. To change this behavior,
  14. you must install a message filter using the acedRegisterFilterWinMsg() function
  15. and set your cursor in the filter. The following sample demonstates how to do
  16. this. It also hides the usual AutoCAD crosshair by moving it to the top left
  17. corner of the window. (As the crosshair is not a usual Windows cursor there
  18. is no other way to hide it currently.)


  19. #include "stdafx.h"
  20. #include "aced.h"
  21. #include "rxmfcapi.h"

  22. HCURSOR hWaitCursor ;

  23. BOOL myCallback (MSG *pMsg) {
  24.     if ( pMsg->message == WM_MOUSEMOVE ) {
  25.         if ( pMsg->lParam == 0 ) //----- our own message
  26.             return (FALSE) ; //----- AutoCAD will move the cross hair up there
  27.         //----- usual message: set our cursor
  28.         ::SetCursor (hWaitCursor) ;
  29.         return (TRUE) ; //----- and don't allow AutoCAD to move the crosshair
  30.     }
  31.     return (FALSE) ; //----- let AutoCAD do what he wants to
  32. }

  33. void test() {
  34.     CView *pView =acedGetAcadDwgView () ;
  35.     hWaitCursor =::LoadCursor (NULL, IDC_WAIT) ;
  36.     HCURSOR hCursor =::SetCursor (hWaitCursor) ;
  37.     //----- we need to post the WM_MOUSEMOVE twice and then it works
  38.     //----- move the mouse to the topleft so the crosshair won't disturb the user
  39.     for ( int i =0 ; i < 2 ; i++ )
  40.         pView->PostMessage (WM_MOUSEMOVE, 0L, 0L) ;

  41.     //----- filter out the WM_MOUSMOVE messages and set our cursor
  42.     acedRegisterFilterWinMsg (myCallback) ;

  43.     //----- do the time consuming operation
  44.     char cResult [256] ;
  45.     ads_getstring (0, "Enter something:", cResult) ;

  46.     //----- end the filtering
  47.     acedRemoveFilterWinMsg (myCallback) ;
  48.     //----- reset the old cursor
  49.     ::SetCursor (hCursor) ;
  50.     CPoint curPos ;
  51.     //----- display it by posting WM_MOUSEMOVE again twice
  52.     ::GetCursorPos (&curPos) ;
  53.     pView->ScreenToClient (&curPos) ;
  54.     for ( i =0 ; i < 2 ; i++ )
  55.         pView->PostMessage (WM_MOUSEMOVE, 0L, MAKELPARAM(curPos.x,curPos.y));
  56. }
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!

已领礼包: 1632个

财富等级: 堆金积玉

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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-9-24 10:18 , Processed in 0.347465 second(s), 33 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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