乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 10|回复: 3

[编程交流] Image_按钮问题

[复制链接]

3

主题

24

帖子

21

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-6 07:07:03 | 显示全部楼层 |阅读模式
我用这个dcl尝试了几乎所有的事情,但它根本不起作用!
我有一个dcl,有2个image\u按钮,分配了colordlg功能。。。在我选择颜色后,图像按钮应该更新为我刚才选择的颜色。。。这根本就没有发生!
 
以下是我遇到问题的代码片段:
  1.   (action_tile "bco" "(setq colb (acad_colordlg 0))")
  2. (start_image "bco")
  3. (fill_image 0 0 (dimx_tile "bco") (dimy_tile "bco") colb)
  4. (end_image)

 
请注意,这只是一个按钮。。。我假设,如果我成功地使用其中一个,我将能够使另一个工作!
 
新年快乐!
提前谢谢!
 
关于Csaba Arpad Dobai!
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 07:30:51 | 显示全部楼层
此示例可能有助于:
 
http://www.cadtutor.net/forum/showthread.php?69478-图像平铺刷新&p=475323&viewfull=1#post475323
回复

使用道具 举报

3

主题

24

帖子

21

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-6 07:58:53 | 显示全部楼层
谢谢Lee Mac占用您的时间,但您能告诉我以下代码出了什么问题吗
 
  1. (defun c:pset ()
  2. (if
  3.    (and
  4.      (setq tmp (vl-filename-mktemp nil nil ".dcl"))
  5.      (setq des (open tmp "w"))
  6.      (foreach line
  7.        '(
  8.          "img : image_button { width = 6; aspect_ratio = 1; fixed_width = true; fixed_height = true; }"
  9.          "col : dialog { label = "Image Button Test";"
  10.          "    : row"
  11.          "    {"
  12.          "        : img { key = "b1"; }"
  13.          "        : img { key = "b2"; }"
  14.          "    }"
  15.          "    : button { label = "OK"; width = 6; key = "accept"; }"
  16.          "    : button { label = "Cancel"; width = 6; key = "cancel"; is_cancel = true; }"
  17.          "}"
  18.         )
  19. (write-line line des)
  20.      )
  21.      (not (setq des (close des)))
  22.      (< 0 (setq dcl (load_dialog tmp)))
  23.      (new_dialog "col" dcl)
  24.    )
  25.     (progn
  26.       (setq col 0)
  27.       (foreach        key '("b1" "b2")
  28. (_fill_image key col)
  29. (action_tile
  30.    key
  31.    (strcat "(_fill_image "b1" " (substr key 2) ")")
  32. )
  33. (action_tile
  34.    key
  35.    (strcat "(_fill_image "b2" " (substr key 2) ")")
  36. )
  37.       )
  38.       (start_dialog)
  39.     )
  40.     (princ "\nError Loading Dialog.")
  41. )
  42. (if (< 0 dcl)
  43.    (setq dcl (unload_dialog dcl))
  44. )
  45. (if (findfile tmp)
  46.    (vl-file-delete tmp)
  47. )
  48. (princ)
  49. )
  50. (defun _fill_image ()
  51. (start_image key)
  52. (fill_image 0 0 (dimx_tile key) (dimy_tile key) col)
  53. (end_image)
  54. )
  55. (princ)

 
正如我之前所说,我想将acad\u colordlg函数分配给按钮,但我不断得到以下错误“参数太多”!
 
顺便说一句,很好的应用程序。。。我冒昧地复制并修改了它!我想做的是当我按下图像按钮加载acad_colordlg时,在我选择颜色后,图像按钮会将其颜色更改为我选择的颜色!到目前为止,我做到了这一点。。。同时加载对话框和颜色对话框,选择颜色,然后按钮将其颜色更改为所选颜色。。。现在,无论我按多少次图像按钮,颜色对话框都不会出现!
 
关于Csaba Arpad Dobai!
回复

使用道具 举报

3

主题

24

帖子

21

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-6 08:16:51 | 显示全部楼层
解决了问题:
 
  1. (defun c:pset (/ col dcl des tmp)
  2. (if
  3.    (and
  4.      (setq tmp (vl-filename-mktemp nil nil ".dcl"))
  5.      (setq des (open tmp "w"))
  6.      (foreach line
  7.        '(
  8.          "img : image_button { width = 24; aspect_ratio = 1; fixed_width = true; fixed_height = true; }"
  9.          "col : dialog { label = "Image Button Test";"
  10.          "    : row"
  11.          "    {"
  12.          "        : img { key = "b1"; }"
  13.          "    }"
  14.          "    : button { label = "OK"; width = 6; key = "accept"; }"
  15.          "    : button { label = "Cancel"; width = 6; key = "cancel"; is_cancel = true; }"
  16.          "}"
  17.         )
  18. (write-line line des)
  19.      )
  20.      (not (setq des (close des)))
  21.      (< 0 (setq dcl (load_dialog tmp)))
  22.      (new_dialog "col" dcl)
  23.    )
  24.     (progn
  25.       (setq col 0)
  26.       (foreach        key '("b1")
  27. (_fill_image key col)
  28. (action_tile
  29.    key
  30.    (strcat "(setq col (acad_colordlg 0)) (_fill_image "b1" " "col" ")")
  31. )
  32.       )
  33.       (start_dialog)
  34.     )
  35.     (princ "\nError Loading Dialog.")
  36. )
  37. (if (< 0 dcl)
  38.    (setq dcl (unload_dialog dcl))
  39. )
  40. (if (findfile tmp)
  41.    (vl-file-delete tmp)
  42. )
  43. (princ)
  44. )
  45. (defun _fill_image (key col)
  46. (start_image key)
  47. (fill_image 0 0 (dimx_tile key) (dimy_tile key) col)
  48. (end_image)
  49. )
  50. (princ)

 
谢谢李。。。没有你的帮助,我是不会做这件事的!
我将不得不工作的确定按钮虽然!!!
 
再次感谢您的帮助!
 
问候Csaba Arpad Dobai!
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-10 15:04 , Processed in 0.507064 second(s), 60 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表