private void buttonEdit_Click(object sender, EventArgs e) { string keyword = this._richTextBox.Text.Substring(this._selectedKeywordStart, this._selectedKeywordLength); KeywordEditor editor = new KeywordEditor(this.applicableKeywords, keyword, this._maxYValueIndex); if (editor.ShowDialog() == DialogResult.OK) { int length = this._selectedKeywordStart; int num2 = this._selectedKeywordLength; this._richTextBox.Text = this._richTextBox.Text.Substring(0, length) + editor.Keyword + this._richTextBox.Text.Substring(length + num2); this._richTextBox.SelectionStart = length + editor.Keyword.Length; } this._richTextBox.Focus(); }
private void buttonInsert_Click(object sender, EventArgs e) { KeywordEditor editor = new KeywordEditor(this.applicableKeywords, string.Empty, this._maxYValueIndex); if (editor.ShowDialog() == DialogResult.OK) { if (this._selectedKeywordLength > 0) { this._richTextBox.SelectionStart += this._richTextBox.SelectionLength; this._richTextBox.SelectionLength = 0; this._richTextBox.SelectedText = " " + editor.Keyword; } else { this._richTextBox.SelectionLength = Math.Max(0, this._selectedKeywordLength); this._richTextBox.SelectedText = editor.Keyword; } } this._richTextBox.Focus(); }