EditingCommands EditingCommands EditingCommands EditingCommands Class

定义

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

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

示例

下面的示例演示如何调用上支持该命令的对象的编辑命令。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. 最编辑命令忽略的命令参数;一般情况下,此参数应为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类不能使用的命令参数 (parameter参数所需的Execute方法)。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 AlignCenter AlignCenter

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

AlignJustify AlignJustify AlignJustify AlignJustify

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

AlignLeft AlignLeft AlignLeft AlignLeft

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

AlignRight AlignRight AlignRight AlignRight

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

Backspace Backspace Backspace Backspace

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

CorrectSpellingError CorrectSpellingError CorrectSpellingError CorrectSpellingError

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

DecreaseFontSize DecreaseFontSize DecreaseFontSize DecreaseFontSize

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

DecreaseIndentation DecreaseIndentation DecreaseIndentation DecreaseIndentation

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

Delete Delete Delete Delete

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

DeleteNextWord DeleteNextWord DeleteNextWord DeleteNextWord

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

DeletePreviousWord DeletePreviousWord DeletePreviousWord DeletePreviousWord

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

EnterLineBreak EnterLineBreak EnterLineBreak 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 EnterParagraphBreak 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 IgnoreSpellingError 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 IncreaseFontSize IncreaseFontSize

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

IncreaseIndentation IncreaseIndentation IncreaseIndentation IncreaseIndentation

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

MoveDownByLine MoveDownByLine MoveDownByLine MoveDownByLine

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

MoveDownByPage MoveDownByPage MoveDownByPage MoveDownByPage

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

MoveDownByParagraph MoveDownByParagraph MoveDownByParagraph MoveDownByParagraph

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

MoveLeftByCharacter MoveLeftByCharacter MoveLeftByCharacter MoveLeftByCharacter

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

MoveLeftByWord MoveLeftByWord MoveLeftByWord MoveLeftByWord

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

MoveRightByCharacter MoveRightByCharacter MoveRightByCharacter MoveRightByCharacter

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

MoveRightByWord MoveRightByWord MoveRightByWord MoveRightByWord

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

MoveToDocumentEnd MoveToDocumentEnd MoveToDocumentEnd MoveToDocumentEnd

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

MoveToDocumentStart MoveToDocumentStart MoveToDocumentStart MoveToDocumentStart

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

MoveToLineEnd MoveToLineEnd MoveToLineEnd MoveToLineEnd

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

MoveToLineStart MoveToLineStart MoveToLineStart MoveToLineStart

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

MoveUpByLine MoveUpByLine MoveUpByLine MoveUpByLine

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

MoveUpByPage MoveUpByPage MoveUpByPage MoveUpByPage

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

MoveUpByParagraph MoveUpByParagraph MoveUpByParagraph MoveUpByParagraph

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

SelectDownByLine SelectDownByLine SelectDownByLine SelectDownByLine

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

SelectDownByPage SelectDownByPage SelectDownByPage SelectDownByPage

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

SelectDownByParagraph SelectDownByParagraph SelectDownByParagraph SelectDownByParagraph

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

SelectLeftByCharacter SelectLeftByCharacter SelectLeftByCharacter SelectLeftByCharacter

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

SelectLeftByWord SelectLeftByWord SelectLeftByWord SelectLeftByWord

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

SelectRightByCharacter SelectRightByCharacter SelectRightByCharacter SelectRightByCharacter

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

SelectRightByWord SelectRightByWord SelectRightByWord SelectRightByWord

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

SelectToDocumentEnd SelectToDocumentEnd SelectToDocumentEnd SelectToDocumentEnd

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

SelectToDocumentStart SelectToDocumentStart SelectToDocumentStart SelectToDocumentStart

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

SelectToLineEnd SelectToLineEnd SelectToLineEnd SelectToLineEnd

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

SelectToLineStart SelectToLineStart SelectToLineStart SelectToLineStart

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

SelectUpByLine SelectUpByLine SelectUpByLine SelectUpByLine

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

SelectUpByPage SelectUpByPage SelectUpByPage SelectUpByPage

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

SelectUpByParagraph SelectUpByParagraph SelectUpByParagraph SelectUpByParagraph

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

TabBackward TabBackward TabBackward TabBackward

表示 TabBackward 命令。Represents the TabBackward command.

TabForward TabForward TabForward TabForward

表示 TabForward 命令。Represents the TabForward command.

ToggleBold ToggleBold ToggleBold ToggleBold

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

ToggleBullets ToggleBullets ToggleBullets 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 ToggleInsert ToggleInsert

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

ToggleItalic ToggleItalic ToggleItalic ToggleItalic

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

ToggleNumbering ToggleNumbering ToggleNumbering 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 ToggleSubscript ToggleSubscript

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

ToggleSuperscript ToggleSuperscript ToggleSuperscript ToggleSuperscript

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

ToggleUnderline ToggleUnderline ToggleUnderline ToggleUnderline

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

适用于

另请参阅