Image_按钮问题
我用这个dcl尝试了几乎所有的事情,但它根本不起作用!我有一个dcl,有2个image\u按钮,分配了colordlg功能。。。在我选择颜色后,图像按钮应该更新为我刚才选择的颜色。。。这根本就没有发生!
以下是我遇到问题的代码片段:
(action_tile "bco" "(setq colb (acad_colordlg 0))")
(start_image "bco")
(fill_image 0 0 (dimx_tile "bco") (dimy_tile "bco") colb)
(end_image)
请注意,这只是一个按钮。。。我假设,如果我成功地使用其中一个,我将能够使另一个工作!
新年快乐!
提前谢谢!
关于Csaba Arpad Dobai! 此示例可能有助于:
http://www.cadtutor.net/forum/showthread.php?69478-图像平铺刷新&p=475323&viewfull=1#post475323 谢谢Lee Mac占用您的时间,但您能告诉我以下代码出了什么问题吗
(defun c:pset ()
(if
(and
(setq tmp (vl-filename-mktemp nil nil ".dcl"))
(setq des (open tmp "w"))
(foreach line
'(
"img : image_button { width = 6; aspect_ratio = 1; fixed_width = true; fixed_height = true; }"
"col : dialog { label = \"Image Button Test\";"
" : row"
" {"
" : img { key = \"b1\"; }"
" : img { key = \"b2\"; }"
" }"
" : button { label = \"OK\"; width = 6; key = \"accept\"; }"
" : button { label = \"Cancel\"; width = 6; key = \"cancel\"; is_cancel = true; }"
"}"
)
(write-line line des)
)
(not (setq des (close des)))
(< 0 (setq dcl (load_dialog tmp)))
(new_dialog "col" dcl)
)
(progn
(setq col 0)
(foreach key '("b1" "b2")
(_fill_image key col)
(action_tile
key
(strcat "(_fill_image \"b1\" " (substr key 2) ")")
)
(action_tile
key
(strcat "(_fill_image \"b2\" " (substr key 2) ")")
)
)
(start_dialog)
)
(princ "\nError Loading Dialog.")
)
(if (< 0 dcl)
(setq dcl (unload_dialog dcl))
)
(if (findfile tmp)
(vl-file-delete tmp)
)
(princ)
)
(defun _fill_image ()
(start_image key)
(fill_image 0 0 (dimx_tile key) (dimy_tile key) col)
(end_image)
)
(princ)
正如我之前所说,我想将acad\u colordlg函数分配给按钮,但我不断得到以下错误“参数太多”!
顺便说一句,很好的应用程序。。。我冒昧地复制并修改了它!我想做的是当我按下图像按钮加载acad_colordlg时,在我选择颜色后,图像按钮会将其颜色更改为我选择的颜色!到目前为止,我做到了这一点。。。同时加载对话框和颜色对话框,选择颜色,然后按钮将其颜色更改为所选颜色。。。现在,无论我按多少次图像按钮,颜色对话框都不会出现!
关于Csaba Arpad Dobai! 解决了问题:
(defun c:pset (/ col dcl des tmp)
(if
(and
(setq tmp (vl-filename-mktemp nil nil ".dcl"))
(setq des (open tmp "w"))
(foreach line
'(
"img : image_button { width = 24; aspect_ratio = 1; fixed_width = true; fixed_height = true; }"
"col : dialog { label = \"Image Button Test\";"
" : row"
" {"
" : img { key = \"b1\"; }"
" }"
" : button { label = \"OK\"; width = 6; key = \"accept\"; }"
" : button { label = \"Cancel\"; width = 6; key = \"cancel\"; is_cancel = true; }"
"}"
)
(write-line line des)
)
(not (setq des (close des)))
(< 0 (setq dcl (load_dialog tmp)))
(new_dialog "col" dcl)
)
(progn
(setq col 0)
(foreach key '("b1")
(_fill_image key col)
(action_tile
key
(strcat "(setq col (acad_colordlg 0)) (_fill_image \"b1\" " "col" ")")
)
)
(start_dialog)
)
(princ "\nError Loading Dialog.")
)
(if (< 0 dcl)
(setq dcl (unload_dialog dcl))
)
(if (findfile tmp)
(vl-file-delete tmp)
)
(princ)
)
(defun _fill_image (key col)
(start_image key)
(fill_image 0 0 (dimx_tile key) (dimy_tile key) col)
(end_image)
)
(princ)
谢谢李。。。没有你的帮助,我是不会做这件事的!
我将不得不工作的确定按钮虽然!!!
再次感谢您的帮助!
问候Csaba Arpad Dobai!
页:
[1]