最初由 xulixin 发布
[B]:i :i 我想将CAD的光标改成圆型,并且圆直径与指定的值一致,也就是当放大缩小时圆相应变化,用ARX FOR 14 可否实现? [/B]
给你贴个ADN资料,设置AUTOCAD的光标。
- Setting the cursor in AutoCAD
- ID 1731
- Applies to: AutoCAD 2000
- AutoCAD 2000I
- AutoCAD 2002
-
- Date 1/25/2002
-
- This document is part of User Interface
- Question
- I am setting the Windows cursor to IDC_WAIT before performing a time-consuming
- operation in AutoCAD. However, AutoCAD resets the cursor every time the mouse
- moves. Can I prevent AutoCAD from changing the current cursor?
- Answer
- AutoCAD resets the cursor on each WM_MOUSEMOVE message. To change this behavior,
- you must install a message filter using the acedRegisterFilterWinMsg() function
- and set your cursor in the filter. The following sample demonstates how to do
- this. It also hides the usual AutoCAD crosshair by moving it to the top left
- corner of the window. (As the crosshair is not a usual Windows cursor there
- is no other way to hide it currently.)
- #include "stdafx.h"
- #include "aced.h"
- #include "rxmfcapi.h"
- HCURSOR hWaitCursor ;
- BOOL myCallback (MSG *pMsg) {
- if ( pMsg->message == WM_MOUSEMOVE ) {
- if ( pMsg->lParam == 0 ) //----- our own message
- return (FALSE) ; //----- AutoCAD will move the cross hair up there
- //----- usual message: set our cursor
- ::SetCursor (hWaitCursor) ;
- return (TRUE) ; //----- and don't allow AutoCAD to move the crosshair
- }
- return (FALSE) ; //----- let AutoCAD do what he wants to
- }
- void test() {
- CView *pView =acedGetAcadDwgView () ;
- hWaitCursor =::LoadCursor (NULL, IDC_WAIT) ;
- HCURSOR hCursor =::SetCursor (hWaitCursor) ;
- //----- we need to post the WM_MOUSEMOVE twice and then it works
- //----- move the mouse to the topleft so the crosshair won't disturb the user
- for ( int i =0 ; i < 2 ; i++ )
- pView->PostMessage (WM_MOUSEMOVE, 0L, 0L) ;
- //----- filter out the WM_MOUSMOVE messages and set our cursor
- acedRegisterFilterWinMsg (myCallback) ;
- //----- do the time consuming operation
- char cResult [256] ;
- ads_getstring (0, "Enter something:", cResult) ;
- //----- end the filtering
- acedRemoveFilterWinMsg (myCallback) ;
- //----- reset the old cursor
- ::SetCursor (hCursor) ;
- CPoint curPos ;
- //----- display it by posting WM_MOUSEMOVE again twice
- ::GetCursorPos (&curPos) ;
- pView->ScreenToClient (&curPos) ;
- for ( i =0 ; i < 2 ; i++ )
- pView->PostMessage (WM_MOUSEMOVE, 0L, MAKELPARAM(curPos.x,curPos.y));
- }
|