首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

怎么给动态生成的ActiveBar加快捷键

2012-01-21 
如何给动态生成的ActiveBar加快捷键如题,我用aTool.ShortCuts Alt+N提示 “对象 shortcuts 的方法 itoo

如何给动态生成的ActiveBar加快捷键
如题,我用aTool.ShortCuts = "Alt+N"提示 “对象 shortcuts 的方法 itool 失败” 
请问我应该怎么添加,谢谢

[解决办法]
常用F1对你会有很大的帮助!!!
Sets or returns a string array of shortcut keys for the tool.

Syntax
[form!]Tool.ShortCuts[ = value As Variant ]

Remarks
The first element in the array will be displayed on the menu as the default shortcut.

To assign values to the ShortCuts property you must first declare a string array as a New shortcut type. You can then use the shortcut value property to assign values to the array items. You can use "Alt", "Control" and "Shift" in the string to specify the <Alt>, <Control> and <Shift> keys respectively. You must spell out the words "Control" and "Shift". The shortcut must be specified in Alt, Control, Shift order. Entering "Control+Alt+N" will generate an error. There cannot by any spaces within the string.

To clear a shortcut, user the shortcut clear method.

Example
Assign Shortcuts:

Private Sub CreateStandardTools()
Dim oTool As Tool
Dim saShortcuts(4) As New ShortCut
' Shortcuts
saShortcuts(0).Value = "Control+Shift+A"
saShortcuts(1).Value = "Control+B"
saShortcuts(2).Value = "Alt+Control+C"
saShortcuts(3).Value = "Alt+O"
saShortcuts(4).Value = "F8"

Set oTool = ActiveBar2.Tools.Add(GetUniqueToolID(), "Open")
oTool.ControlType = ddTTButton
oTool.Caption = "&Open"
oTool.Shortcuts = saShortcuts
End Sub


Clear Shortcut:

Dim saShortcuts(4) As New ShortCut
' Shortcuts
saShortcuts(0).Clear
saShortcuts(1).Clear
saShortcuts(2).Clear
saShortcuts(3).Clear
saShortcuts(4).Clear

ActiveBar2.Tools("Open").Shortcuts = saShortcuts


Data Type
shortcut

热点排行