EditingCommands 类

定义

提供一组标准的与编辑相关的命令。Provides a standard set of editing related commands.

public ref class EditingCommands abstract sealed
public static class EditingCommands
type EditingCommands = class
Public Class EditingCommands
继承
EditingCommands

示例

下面的示例演示如何在支持命令的对象上调用编辑命令。The following example demonstrates how to invoke an editing command on an object that supports the command.

在此示例中,RichTextBox 用作命令目标。For this example, a RichTextBox serves as the command target. 请注意,RichTextBox 实现 IInputElement 接口(从 FrameworkElement继承),并且它包括对许多编辑命令的本机支持。Note that RichTextBox implements the IInputElement interface (inherited from FrameworkElement), and that it includes native support for many editing commands.

Execute 方法的第一个参数是命令参数。The first argument for the Execute method is a command parameter. 大多数编辑命令忽略 command 参数;通常,应为编辑命令 null 此参数。Most editing commands ignore the command parameter; in general, this parameter should be null for editing commands.

第二个参数指定要将命令路由到的对象。The second argument specifies the object to which the command will be routed. 此对象必须实现 IInputElement 接口,并应包括指定命令的处理程序。This object must implement the IInputElement interface, and should include a handler for the specified command. 通常,在不处理命令的对象上调用命令时,将忽略该命令。Generally, a command is ignored when invoked on an object that does not handle the command.

RichTextBox rTB = new RichTextBox();

EditingCommands.ToggleInsert.Execute(null, rTB);
Dim rTB As New RichTextBox()

EditingCommands.ToggleInsert.Execute(Nothing, rTB)

注解

下表显示了编辑命令和关联的默认键笔势(其中包含来自 KeyModifierKeys 枚举的键名)。The following table shows the editing commands and the associated default key gestures (with key names from the Key and ModifierKeys enumerations).

编辑命令Editing command 默认键笔势Default key gesture
AlignCenter Ctrl+E
AlignJustify Ctrl+J
AlignLeft Ctrl+L
AlignRight Ctrl+R
Backspace Backspace
CorrectSpellingError 无默认键笔势no default key gesture
DecreaseFontSize Ctrl+OemOpenBrackets
DecreaseIndentation Ctrl+Shift+T
Delete Delete
DeleteNextWord Ctrl+Delete
DeletePreviousWord Ctrl+Backspace
EnterLineBreak Shift+Enter
EnterParagraphBreak Enter
IgnoreSpellingError 无默认键笔势no default key gesture
IncreaseFontSize Ctrl+OemCloseBrackets
IncreaseIndentation Ctrl+T
MoveDownByLine Down
MoveDownByPage PageDown
MoveDownByParagraph Ctrl+Down
MoveLeftByCharacter Left
MoveLeftByWord Ctrl+Left
MoveRightByCharacter Right
MoveRightByWord Ctrl+Right
MoveToDocumentEnd Ctrl+End
MoveToDocumentStart Ctrl+Home
MoveToLineEnd End
MoveToLineStart Home
MoveUpByLine Up
MoveUpByPage PageUp
MoveUpByParagraph Ctrl+Up
SelectDownByLine Shift+Down
SelectDownByPage Shift+PageDown
SelectDownByParagraph Ctrl+Shift+Down
SelectLeftByCharacter Shift+Left
SelectLeftByWord Ctrl+Shift+Left
SelectRightByCharacter Shift+Right
SelectRightByWord Ctrl+Shift+Right
SelectToDocumentEnd Ctrl+Shift+End
SelectToDocumentStart Ctrl+Shift+Home
SelectToLineEnd Shift+End
SelectToLineStart Shift+Home
SelectUpByLine Shift+Up
SelectUpByPage Shift+PageUp
SelectUpByParagraph Ctrl+Shift+Up
TabBackward Shift+Tab
TabForward Tab
ToggleBold Ctrl+B
ToggleBullets Ctrl+Shift+L
ToggleInsert Insert
ToggleItalic Ctrl+I
ToggleNumbering Ctrl+Shift+N
ToggleSubscript Ctrl+OemPlus
ToggleSuperscript Ctrl+Shift+OemPlus
ToggleUnderline Ctrl+U

脱字号移动命令和选择扩展命令共享一组通用的默认键笔势,一般差别在于添加了 Shift 键,以将选择的命令与插入符号移动命令区分开来。Caret movement commands and selection expanding commands share a common set of default key gestures, the general difference being the addition of the Shift key to differentiate selection commands from caret movement commands. 例如,MoveLeftByCharacter 命令的默认键笔势为 Left,相应的 SelectLeftByCharacter 命令的默认键笔势为 Shift+LeftFor example, the MoveLeftByCharacter command has a default key gesture of Left, and the corresponding SelectLeftByCharacter command has a default key gesture of Shift+Left.

通常,EditingCommands 类提供的命令定义不使用命令参数(Execute 方法所需的 parameter 参数)。In general, the command definitions provided by the EditingCommands class do not make use of command parameters (the parameter parameter expected by the Execute method).

有关命令和命令的详细信息,请参阅输入概述For more information on commands and commanding, see Input Overview.

属性

AlignCenter

表示 AlignCenter 命令,该命令请求将当前段落或选中的段落居中。Represents the AlignCenter command, which requests that the current paragraph or a selection of paragraphs be centered.

AlignJustify

表示 AlignJustify 命令,该命令请求将当前段落或选中的段落两端对齐。Represents the AlignJustify command, which requests that the current paragraph or a selection of paragraphs be justified.

AlignLeft

表示 AlignLeft 命令,该命令请求将所选内容左对齐。Represents the AlignLeft command, which requests that a selection of content be aligned left.

AlignRight

表示 AlignRight 命令,该命令请求将所选内容右对齐。Represents the AlignRight command, which requests that a selection of content be aligned right.

Backspace

表示 Backspace 命令,该命令请求在当前位置或当前所选内容上输入一个退格。Represents the Backspace command, which requests that a backspace be entered at the current position or over the current selection.

CorrectSpellingError

表示 CorrectSpellingError 命令,该命令请求更正当前位置任何拼写错误的单词。Represents the CorrectSpellingError command, which requests that any misspelled word at the current position be corrected.

DecreaseFontSize

表示 DecreaseFontSize 命令,该命令请求将当前所选内容的字号缩小 1 磅。Represents the DecreaseFontSize command, which requests that the font size for the current selection be decreased by 1 point.

DecreaseIndentation

表示 DecreaseIndentation 命令,该命令请求将当前段落的缩进减少一个制表位。Represents the DecreaseIndentation command, which requests that indentation for the current paragraph be decreased by one tab stop.

Delete

表示 Delete 命令,该命令请求删除当前所选内容。Represents the Delete command, which requests that the current selection be deleted.

DeleteNextWord

表示 DeleteNextWord 命令,该命令请求删除下一单词(相对于当前位置而言)。Represents the DeleteNextWord command, which requests that the next word (relative to a current position) be deleted.

DeletePreviousWord

表示 DeletePreviousWord 命令,该命令请求删除上一单词(相对于当前位置而言)。Represents the DeletePreviousWord command, which requests that the previous word (relative to a current position) be deleted.

EnterLineBreak

表示 EnterLineBreak 命令,该命令请求在当前位置或当前所选内容上插入一个换行符。Represents the EnterLineBreak command, which requests that a line break be inserted at the current position or over the current selection.

EnterParagraphBreak

表示 EnterParagraphBreak 命令,该命令请求在当前位置或当前所选内容上插入一个分段符。Represents the EnterParagraphBreak command, which requests that a paragraph break be inserted at the current position or over the current selection.

IgnoreSpellingError

表示 IgnoreSpellingError 命令,该命令请求忽略当前位置或当前所选内容中任何拼写错误的单词的实例。Represents the IgnoreSpellingError command, which requests that any instances of misspelled words at the current position or in the current selection be ignored.

IncreaseFontSize

表示 IncreaseFontSize 命令,该命令请求将当前所选内容的字号增加 1 磅。Represents the IncreaseFontSize command, which requests that the font size for the current selection be increased by 1 point.

IncreaseIndentation

表示 IncreaseIndentation 命令,该命令请求将当前段落的缩进增加一个制表位。Represents the IncreaseIndentation command, which requests that indentation for the current paragraph be increased by one tab stop.

MoveDownByLine

表示 MoveDownByLine 命令,该命令请求将插入符号向下移动一行。Represents the MoveDownByLine command, which requests that the caret move down by one line.

MoveDownByPage

表示 MoveDownByPage 命令,该命令请求将插入符号向下移动一页。Represents the MoveDownByPage command, which requests that the caret move down by one page.

MoveDownByParagraph

表示 MoveDownByParagraph 命令,该命令请求将插入符号向下移动一个段落。Represents the MoveDownByParagraph command, which requests that the caret move down by one paragraph.

MoveLeftByCharacter

表示 MoveLeftByCharacter 命令,该命令请求将插入符号向左移动一个字符。Represents the MoveLeftByCharacter command, which requests that the caret move one character left.

MoveLeftByWord

表示 MoveLeftByWord 命令,该命令请求将插入符号向左移动一个单词。Represents the MoveLeftByWord command, which requests that the caret move one word left.

MoveRightByCharacter

表示 MoveRightByCharacter 命令,该命令请求将插入符号向右移动一个字符。Represents the MoveRightByCharacter command, which requests that the caret move one character right.

MoveRightByWord

表示 MoveRightByWord 命令,该命令请求将插入符号向右移动一个单词。Represents the MoveRightByWord command, which requests that the caret move right by one word.

MoveToDocumentEnd

表示 MoveToDocumentEnd 命令,该命令请求将插入符号移至内容的末尾。Represents the MoveToDocumentEnd command, which requests that the caret move to the very end of content.

MoveToDocumentStart

表示 MoveToDocumentStart 命令,该命令请求将插入符号移至内容的开头。Represents the MoveToDocumentStart command, which requests that the caret move to the very beginning of content.

MoveToLineEnd

表示 MoveToLineEnd 命令,该命令请求将插入符号移至当前行的末尾。Represents the MoveToLineEnd command, which requests that the caret move to the end of the current line.

MoveToLineStart

表示 MoveToLineStart 命令,该命令请求将插入符号移至当前行的开头。Represents the MoveToLineStart command, which requests that the caret move to the beginning of the current line.

MoveUpByLine

表示 MoveUpByLine 命令,该命令请求将插入符号向上移动一行。Represents the MoveUpByLine command, which requests that the caret move up by one line.

MoveUpByPage

表示 MoveUpByPage 命令,该命令请求将插入符号向上移动一页。Represents the MoveUpByPage command, which requests that the caret move up by one page.

MoveUpByParagraph

表示 MoveUpByParagraph 命令,该命令请求将插入符号向上移动一个段落。Represents the MoveUpByParagraph command, which requests that the caret move up by one paragraph.

SelectDownByLine

表示 SelectDownByLine 命令,该命令请求将当前选择范围向下扩展一行。Represents the SelectDownByLine command, which requests that the current selection be expanded down by one line.

SelectDownByPage

表示 SelectDownByPage 命令,该命令请求将当前选择范围向下扩展一页。Represents the SelectDownByPage command, which requests that the current selection be expanded down by one page.

SelectDownByParagraph

表示 SelectDownByParagraph 命令,该命令请求将当前选择范围向下扩展一段。Represents the SelectDownByParagraph command, which requests that the current selection be expanded down by one paragraph.

SelectLeftByCharacter

表示 SelectLeftByCharacter 命令,该命令请求将当前选择范围向左扩展一个字符。Represents the SelectLeftByCharacter command, which requests that the current selection be expanded left by one character.

SelectLeftByWord

表示 SelectLeftByWord 命令,该命令请求将当前选择范围向左扩展一个单词。Represents the SelectLeftByWord command, which requests that the current selection be expanded left by one word.

SelectRightByCharacter

表示 SelectRightByCharacter 命令,该命令请求将当前选择范围向右扩展一个字符。Represents the SelectRightByCharacter command, which requests that the current selection be expanded right by one character.

SelectRightByWord

表示 SelectRightByWord 命令,该命令请求将当前选择范围向右扩展一个单词。Represents the SelectRightByWord command, which requests that the current selection be expanded right by one word.

SelectToDocumentEnd

表示 SelectToDocumentEnd 命令,该命令请求将当前选择范围扩展到内容末尾处。Represents the SelectToDocumentEnd command, which requests that the current selection be expanded to the very end of content.

SelectToDocumentStart

表示 SelectToDocumentStart 命令,该命令请求将当前选择范围扩展到内容开头处。Represents the SelectToDocumentStart command, which requests that the current selection be expanded to the very beginning of content.

SelectToLineEnd

表示 SelectToLineEnd 命令,该命令请求将当前选择范围扩展到当前行的末尾。Represents the SelectToLineEnd command, which requests that the current selection be expanded to the end of the current line.

SelectToLineStart

表示 SelectToLineStart 命令,该命令请求将当前选择范围扩展到当前行的开头。Represents the SelectToLineStart command, which requests that the current selection be expanded to the beginning of the current line.

SelectUpByLine

表示 SelectUpByLine 命令,该命令请求将当前选择范围向上扩展一行。Represents the SelectUpByLine command, which requests that the current selection be expanded up by one line.

SelectUpByPage

表示 SelectUpByPage 命令,该命令请求将当前选择范围向上扩展一页。Represents the SelectUpByPage command, which requests that the current selection be expanded up by one page.

SelectUpByParagraph

表示 SelectUpByParagraph 命令,该命令请求将当前选择范围向上扩展一段。Represents the SelectUpByParagraph command, which requests that the current selection be expanded up by one paragraph.

TabBackward

表示 TabBackward 命令。Represents the TabBackward command.

TabForward

表示 TabForward 命令。Represents the TabForward command.

ToggleBold

表示 ToggleBold 命令,该命令请求对当前所选内容进行 Bold 格式切换。Represents the ToggleBold command, which requests that Bold formatting be toggled on the current selection.

ToggleBullets

表示 ToggleBullets 命令,该命令请求对当前所选内容进行无序列表(也称为项目符号列表)格式切换。Represents the ToggleBullets command, which requests that unordered list (also referred to as bulleted list) formatting be toggled on the current selection.

ToggleInsert

表示 ToggleInsert 命令,该命令用于切换“插入”和“改写”键入模式。Represents the ToggleInsert command, which toggles the typing mode between Insert and Overtype.

ToggleItalic

表示 ToggleItalic 命令,该命令请求对当前所选内容进行 Italic 格式切换。Represents the ToggleItalic command, which requests that Italic formatting be toggled on the current selection.

ToggleNumbering

表示 ToggleNumbering 命令,该命令请求对当前所选内容进行排序列表(也称为编号列表)格式切换。Represents the ToggleNumbering command, which requests that ordered list (also referred to as numbered list) formatting be toggled on the current selection.

ToggleSubscript

表示 ToggleSubscript 命令,该命令请求对当前所选内容进行下标格式切换。Represents the ToggleSubscript command, which requests that subscript formatting be toggled on the current selection.

ToggleSuperscript

表示 ToggleSuperscript 命令,该命令请求对当前所选内容进行上标格式切换。Represents the ToggleSuperscript command, which requests that superscript formatting be toggled on the current selection.

ToggleUnderline

表示 ToggleUnderline 命令,该命令请求对当前所选内容进行 Underline 格式切换。Represents the ToggleUnderline command, which requests that Underline formatting be toggled on the current selection.

适用于

另请参阅