2010-04-22 39 views

回答

1

如果你想从那里你现在调试然后

int lineNumber = (new StackTrace()).GetFrame(1).GetFileLineNumber(); 

我认为这是你的问题有帮助的编辑控制获取当前行号。

11

这为我工作:

this.WordWrap = false; 
int cursorPosition = this.SelectionStart; 
int lineIndex = this.GetLineFromCharIndex(cursorPosition); 
string lineText = this.Lines[lineIndex]; 
this.WordWrap = true;