本帖最后由 highflybir 于 2011-7-3 20:00 编辑
在前面的帖子我已经提到了grdraw,
如果楼主非得要动态的话,可以这样。。。。
 - (defun c:tt (/ CONT DYNP MOD RET UN X0 X1 X2 Y0 Y1 Y2)
- (setq cont T)
- (while (and cont (SETQ dynP (GRREAD T 15 2)))
- (setq Ret (cadr dynP))
- (setq mod (car dynP))
- (cond
- ((= mod 3) ;如果点取
- (princ "\n你点取的坐标是: ")
- (princ ret) ;返回点
- (princ ",执行动作...\n") ;执行你自己的动作
- )
- ((= mod 5) ;拖动模式
- (command ".redraw")
- (setq un (getvar "viewsize"))
- (setq un (/ un 10))
- (setq x0 (car ret))
- (setq y0 (cadr ret))
- (setq x1 (+ x0 un))
- (setq x2 (- x0 un))
- (setq y1 (+ y0 un))
- (setq y2 (- y0 un))
- (grdraw (list x1 y0) (list x2 y0) -1 1)
- (grdraw (list x0 y1) (list x0 y2) -1 1)
- (setq cont T)
- )
- ((= mod 2) ;键盘输入
- (princ (chr ret))
- )
- (t ;其他情况则退出程序
- (setq cont nil)
- )
- )
- )
- (command ".redraw")
- (princ)
- )
不过grread不支持捕捉。需要捕捉的话,必须另写模拟函数,或者可以搜搜dyndraw |