Hi Kamen,
This can be achived by handling the CurrentCellControlGotFocus event of the Grid and subscribe the GridTextBoxControl.MouseDown event to detect the right mousebutton. In the MouseDown eventhandler, you can use the TextBox.SelectionLength/TextBox.SelectedText property of the GridTextBoxControl to replace the selected text. Below are the codes:
private void gridControl1_CurrentCellControlGotFocus(object sender, System.Windows.Forms.ControlEventArgs e)
{
GridTextBoxControl GridTextBox = e.Control as GridTextBoxControl;
GridTextBox.MouseDown +=new MouseEventHandler(GridTextBox_MouseDown);
}
private void GridTextBox_MouseDown(object sender, MouseEventArgs e)
{
if( e.Button == MouseButtons.Right )
{
GridTextBoxControl GridTextBox = sender as GridTextBoxControl;
if( GridTextBox.SelectionLength > 0)
{
GridTextBox.SelectedText = "RightProcess";
}
}
}
Please refer to the attached sample for implementation and let me know if this helps.
ReplaceSelectText.zipBest regards,
Haneef