我正在为 Autodesk Inventor(一个 3D CAD 程序)编写一个插件。该插件向 Inventor 添加了一系列内部命令,并为每个命令创建了一个工具栏按钮。我需要将每个命令的 Execute 事件连接到加载项中的处理程序函数。
我创建了一个“MyCommand”类,其中包含定义命令所需的所有信息。我还创建了一个 List(Of MyCommand) ,其中包含每个命令的定义。最后,我可以遍历每个命令并创建内部 Inventor 命令定义,以及将按钮添加到工具栏。但是,我不知道该怎么做是将命令与其 Handler 函数在 loop 内关联起来。
下面的示例代码说明了我所追求的:
Sub CreateCommands()
Dim oCommands As New List(Of MyCommand)
oCommands.Add(New MyCommand("DrawLogoCmd", "Draw Logo", "DrawLogoSub"))
oCommands.Add(New MyCommand("PublishDrawingCmd", "Publish Drawing", "PublishDrawingSub"))
' [Dozens more commands]
For Each oCommand As MyCommand In oCommands
' Code for adding internal command definition and button to Inventor. This is working fine.
Dim oCommandDef As Inventor.CommandDefinition = InventorApp.CommandDefinitions.Add(oCommand.InternalDefinitionName, oCommand.DisplayName)
InventorApp.ToolbarButtons.Add(oCommandDef)
' Associate command definition with …Run Code Online (Sandbox Code Playgroud) 我在Visual Studio中编写一些vb.net代码。我已经启用了智能缩进功能,并且希望继续启用它。但是,我的代码中有一部分我想使用一些额外的缩进以更易于理解的方式概述事物。我可以跳到所需的缩进级别,但是一旦我切换到另一行,智能缩进就会将该行推回到“应该”的位置。
如何在不完全禁用智能缩进的情况下向代码中的某些行添加一些额外的缩进?
Call GetRibbon("Part")
Call GetTab("3D Model")
Call NewButton("Custom1")
Call GetRibbon("Assembly")
Call GetTab("Assemble")
Call NewButton("Custom2")
Run Code Online (Sandbox Code Playgroud)
VS如何格式化:
Call GetRibbon("Part")
Call GetTab("3D Model")
Call NewButton("Custom1")
Call GetRibbon("Assembly")
Call GetTab("Assemble")
Call NewButton("Custom2")
Run Code Online (Sandbox Code Playgroud) Find All References 工具非常有用,但我经常发现自己希望能够刷新结果,例如:
据我所知,没有办法刷新结果,但我觉得这很难相信。我是忽略了什么还是这真的是一个缺失的功能?
我知道我可以去某个方法/变量/等的地方。使用时,右键单击它,然后再次执行“查找所有引用”,但这比单击“刷新”按钮要乏味得多。