ChangeParagraphBackColorCommand.ForceExecute(ICommandUIState) Method
Executes the command specifying the UI state explicitly.
Namespace: DevExpress.XtraRichEdit.Commands
Assembly: DevExpress.RichEdit.v14.2.Core.dll
#Declaration
#Parameters
Name | Type | Description |
---|---|---|
state | ICommand |
An object which implements the ICommand |
#Remarks
The Command.Execute method performs the UI state check implicitly, so you cannot bring the command to action arbitrarily. Unlike the Execute method, the ForceExecute method enables you to check the UI state for the command, and then deliberately and unconditionally start its execution, or decline it.
The following code snippet demonstrates how the ICommandUIState.EditValue property should be used to execute value-based commands, such as ChangeFontBackColorCommand, ChangeFontColorCommand, ChangeFontNameCommand, ChangeFontSizeCommand, ChangeParagraphBackColorCommand.
ChangeFontBackColorCommand cmd = new ChangeFontBackColorCommand(richEditControl1);
DevExpress.Utils.Commands.IValueBasedCommandUIState<Color> state =
cmd.CreateDefaultCommandUIState()
as DevExpress.Utils.Commands.IValueBasedCommandUIState<Color>;
state.Value = Color.Yellow;
cmd.ForceExecute(state);