0

我开发了一个记事本应用程序。在那我使用了行号和自动换行等等。
我的问题是当我点击wordwrapItem.Click=false它不会减少
标签中的行号。这是我的代码:

private void UpdateNumberLabel  
{  
Point pos = new Point(0, 0);  
int firstIndex = richTextBox1.GetCharIndexFromPosition(pos);  
int firstLine = richTextBox1.GetLineFromCharIndex(firstIndex);  

pos.X = ClientRectangle.Width;  
pos.Y = ClientRectangle.Height;  
int lastIndex = richTextBox1.GetCharIndexFromPosition(pos);  
int lastLine = richTextBox1.GetLineFromCharIndex(lastIndex);  
pos = richTextBox1.GetPositionFromCharIndex(lastIndex);  
UpdateLabel.Text = "";  
int i=0;  
for (i = firstLine; i <= lastLine + 1; i++)  
{  
UpdateLabel.Text += i + 1 + "\n";                      
}  
}  
4

0 回答 0