如何使用RubberDuck'@PredeclaredID设置属性VB_PredeclaredId [英] How to set the Attribute VB_PredeclaredId using RubberDuck '@PredeclaredID

查看:139
本文介绍了如何使用RubberDuck'@PredeclaredID设置属性VB_PredeclaredId的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为Rubberduck和OOP的新手,我仍在学习如何使用该软件并利用编程技术

As a Rubberduck and OOP newbie I'm still learning how to use the software and take advantage of the programming techniques

我第一次看到文件夹注释( https://github.com/rubberduck-vba/Rubberduck/wiki/Using-@Folder-Annotations ),它的工作原理非常直观.

First time I saw about folder annotations (https://github.com/rubberduck-vba/Rubberduck/wiki/Using-@Folder-Annotations) it was quite intuitive how it worked.

但是随后出现了VB_Attribute注释( https://github.com/rubberduck-vba/Rubberduck/wiki/VB_Attribute-Annotations ),我不太了解如何使它们工作.

But then came the VB_Attribute Annotations (https://github.com/rubberduck-vba/Rubberduck/wiki/VB_Attribute-Annotations) which I didn't quite know how to made them work.

希望这可以节省一些人使用该功能的时间

Hope this saves some time to peolple looking to use this feature

为了使属性的需求具体化,这是克里斯托弗·J·麦克莱伦(Christopher J. McClellan)发现的一篇很棒的帖子

To contextualize the need of Attributes, here is a great post I found by Christopher J. McClellan

RubberDuck的优点在于您不需要手动执行导出/编辑/导入"部分,只需单击几次即可完成操作,如下面的答案所述.

And the beauty about RubberDuck is that you don't need to do the Export/Edit/Import part manually, and it does it with a couple of clicks as described in the answer bellow.

推荐答案

要应用预先声明的ID(将其设置为true),请执行以下步骤:

To apply a predeclared id (set it to true) follow this steps:

1-启用Rubberduck代码浏览器窗口

1- Enable the Rubberduck code explorer window

2-在课程的顶部,添加文本:'@PredeclaredID

2- At the top of the class, add the text: '@PredeclaredID

注意:在代码资源管理器"窗口中,您可以看到某个类的Predeclared Attribute设置为true的原因,因为该类的名称旁边带有(PredeclaredId),

Note: In the Code Explorer Window you can see when a Class has a Predeclared Attribute set to true because it has (PredeclaredId) in parenthesis next to its name

3-启动Rubberduck代码检查"

3- Launch Rubberduck "Code inspections"

4-点击刷新"按钮

5-在按描述过滤"文本框中,键入"pred"

5- In the "filter by descripcion" textbox type "pred"

6-选择问题,然后单击修复"按钮

6- Select the Issue and click the "fix" button

7-选择调整属性值"

7- Select "Adjust attributes value"

现在,代码浏览器应该在类名旁边显示"Predeclared"标签

Now the code explorer should show the "Predeclared" tag next to the class name

这篇关于如何使用RubberDuck'@PredeclaredID设置属性VB_PredeclaredId的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆