private void Txt_Row_SEQ_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter) { if (!Int32.TryParse(Txt_Row_SEQ.Text, out int line)) { MessageBox.Show("Please enter number"); } else { richTextBox1.DeselectAll(); int index = richTextBox1.GetFirstCharIndexFromLine(line - 1); richTextBox1.Select(index, 0); richTextBox1.ScrollToCaret(); RTB_Count_Char.DeselectAll(); } } } catch { MessageBox.Show("This row not exist"); } }
public void Create_Ruler() { if (!RTB_Count_Char.Text.Any()) { int z = -10; RTB_Count_Char.AppendText(" \t\t"); for (int i = 0; i < 600; i++) { if (z < 99) { RTB_Count_Char.AppendText($" {z += 10} "); } if (z == 100) { RTB_Count_Char.AppendText($" {z += 10} "); } if (z > 100 && z < 1000) { RTB_Count_Char.AppendText($" {z += 10} "); } if (z == 1000) { RTB_Count_Char.AppendText($" {z += 10} "); } if (z > 1000) { RTB_Count_Char.AppendText($" {z += 10} "); } } RTB_Count_Char.AppendText("\n"); RTB_Count_Char.AppendText(" \t\t"); for (int i = 0; i < 604; i++) { for (int j = 1; j <= 9; j++) { RTB_Count_Char.AppendText($"{j}"); } RTB_Count_Char.AppendText("|"); } } }