如何在statusStrip上显示文字所在的行和列
小弟用VS编写一个记事本,想在statusStrip上显示光标移动所在的行和列,但是不会用,请高手指教,感激不尽!
程序代码: int row = txt_编辑区.GetLineFromCharIndex(txt_编辑区.SelectionStart);//直接得到行号
int col;
int start = 0;
int cursor = txt_编辑区.SelectionStart;
while (start < cursor)
{
if (row == txt_编辑区.GetLineFromCharIndex(start))//检索到行首的位置
{
break;
}
else
{
start++;
}
}
col = cursor - start;//当前光标位置的总字符数-行首所在位置的总字符数就是列号
row++;
col++;
statusStrip1.Items[2].Text = " 行数:" + row.ToString() + " 列数:" + col.ToString();[ 本帖最后由 jedypjd 于 2009-10-31 09:10 编辑 ]








