Pat*_*son 15
如果您的意思是WinForms,请使用该SeletionStart属性访问Carret的当前位置.这是获取索引,当前行和当前列的代码.
int index = myTextBox.SelectionStart;
int currentLine = myTextBox.GetLineFromCharIndex(index);
int currentColumn = index - myTextBox.GetFirstCharIndexFromLine(currentLine);
Run Code Online (Sandbox Code Playgroud)