編輯

共用方式為


KeyBinding Interface

Definition

Represents a custom key assignment in the current context.

public interface class KeyBinding
[System.Runtime.InteropServices.Guid("00020998-0000-0000-C000-000000000046")]
public interface KeyBinding
type KeyBinding = interface
Public Interface KeyBinding
Attributes

Remarks

The KeyBinding object is a member of the KeyBindings collection. Custom key assignments are made in the Customize Keyboard dialog box.

Use KeyBindings(index), where index is the index number, to return a single KeyBinding object.

You can also use the FindKey[Int32, Object] property and the Key(Int32, Object) method to return a KeyBinding object.

Properties

Application

Returns a Application object that represents the Microsoft Word application.

Command

Returns the command assigned to the specified key combination.

CommandParameter

Returns the command parameter assigned to the specified shortcut key.

Context

Returns an object that represents the storage location of the specified key binding. This property can return a Document, Template, or Application object.

Creator

Returns a 32-bit integer that indicates the application in which the specified object was created.

KeyCategory

Returns the type of item assigned to the specified key binding.

KeyCode

Returns a unique number for the first key in the specified key binding.

KeyCode2

Returns a unique number for the second key in the specified key binding.

KeyString

Returns the key combination string for the specified keys (for example, CTRL+SHIFT+A).

Parent

Returns an object that represents the parent object of the specified object.

Protected

True if you cannot change the specified key binding in the Customize Keyboard dialog box (from the Tools menu, click Customize, and then click the Keyboard button).

Methods

Clear()

Removes the key binding from the KeyBindings collection and resets a built-in command to its default key assignment.

Disable()

Removes the specified key combination if it's currently assigned to a command.

Execute()

Runs the command associated with the specified key combination.

Rebind(WdKeyCategory, String, Object)

Changes the command assigned to the specified key binding.

Applies to