用API实现在位输入标题栏内容

上一篇文章,我们创建了自己的对话框进行iProperties的输入。本篇文章将介绍一个不错的例子,是Brian编写的,用来实现工程图标题栏内容的输入。原文地址:

http://modthemachine.typepad.com/my_weblog/iproperties/

When writing the previous post about a custom dialog for iProperty entry I had forgotten about another example I had put together a couple of years ago.  This is similar but I think is better at demonstrating how useful this concept can be.  In this case there’s a custom dialog that looks like a title block.  This significantly simplifies filling out the title block.  Instead of the user having to search through the iProperties dialog and remember which property corresponds to which field on the title block they just fill out the title block directly.  For this example, one of the fields is also a prompted text entry to demonstrate that you’re not limited to only using iProperties.  This sample doesn’t demonstrate it but it could also use drop-down fields with lists like that shown in the previous post.

Inventor工程图里标题栏里的内容由标题栏定义设置,其中有三种文字:
普通静态文字:即定义里是什么内容,标题栏显示的就是什么
提示文字: 当标题栏插入时,会有一个字串提示该是什么方面的内容,由用户自己输入最终的显示内容
关联文字:定义时该文字和某个文档iProperties关联,当标题栏插入时,自动找到对应iProperties的内容

总之,没有一个直观的标题栏编写方式。

When the program is run, this is what the user sees.  It’s a VBA dialog that was created by doing a screen shot of the title block and inserting that as an image on the dialog.  The various text controls were added on top of the image.

Brian用VBA写了个小例子,根据某种工程图标题栏样式,创建出一个在位编辑的对话框,和在图纸看到的对应,如下图

CustomTitleBlock

One the dialog is filled out and the “Apply” button is pressed it sets the corresponding iProperties and the prompted text and then the title block automatically updates to reflect those changes.  Here’s the result.

用户可以在这里,直接进行输入,点击Apply后,标题栏就显示出输入的内容,达到“所见即所得”。

CustomTitleBockResults

Here’s a zip file containing a sample drawing that has the custom iProperties and the prompted text field the sample program expects and it contains a VBA project that contains the source code.  If you want to implement this within your company I would recommend writing this as an add-in rather than VBA, like the previous postdemonstrates.

这个例子的源代码可在这里下载zip file ,其中包括了测试的工程图和自定义的iProperties。因为标题栏样式是多样的,你需要根据具体的样式,让对话框的样式自动的进行匹配。另外,最好写成插件,而不是用VBA。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值