2011-12-18 34 views
0

我正在使用C#ICSharpCode.TextEditor,並且我遇到了一個小問題,當我雙擊TreeView框中一側的方法時,文本應該顯示出您的位置'正在選擇,而不是在線的末尾。TabControl編輯器(TextBox) - TreeView問題

這裏是我的代碼:

private void solutionBox_DoubleClick(object sender, EventArgs e) 
{ 
    TextEditorControl editor = ActiveEditor; 
    if (solutionBox.SelectedNode.Text == "AddAura") 
    { 
     editor.Text += "Add()"; 
    } 
} 

現在會去在文本編輯器,我的自定義代碼末尾:

function Hello(pThis) 
    pThis: 
endAdd() 

所以,我要的是,當你身邊'pThis',當你雙擊'Add()'時,它會出現在'pThis'&旁邊,而不是在TextBox中查找行的結尾。

我知道'+ ='正在導致它,但我想從其他人那裏得到更多的選擇。

回答

0

不知道我是否理解你..但沒有editor.Text有一個Append()方法..?

+0

我修好了。不過謝謝。 :P – 2011-12-19 05:18:00

+0

什麼是你的修復只是出於好奇 – MethodMan 2011-12-19 13:52:55

+0

'private void solutionBox_DoubleClick(object sender,EventArgs e) { TextEditorControl editor = ActiveEditor; var text =「」; var p = editor.ActiveTextAreaControl.TextArea; var index = 0; if(solutionBox.SelectedNode.Text.Contains(「AddThisTest」)) { text =「AddThisTest」; index = p.Caret.Offset; editor.Text = editor.Text.Insert(index,text); return; } }' – 2011-12-19 21:12:47