I developed a notepad application . In that i used Line Numbers and wordwrap and all.
My Problem is when i click wordwrapItem.Click=false
it will not reduce the line number in
Label. This is My Code:
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";
}
}