private void Code_Box_KeyUp(object sender, KeyEventArgs e) { int pos = Code_Box.SelectionStart; int row = Code_Box.GetLineFromCharIndex(pos); int col = pos - Code_Box.GetFirstCharIndexOfCurrentLine(); if (Code_Box.SelectionLength > 0) { Id_Rows_Columns.Text = $"Linha: {row} | Coluna: {col} | Seleção: {Code_Box.SelectionLength}"; } else { Id_Rows_Columns.Text = $"Linha: {row} | Coluna: {col}"; } }
private void Run_Comment_Code_Box() { int start_index = Code_Box.SelectionStart; int len = 0; foreach (string l in Code_Box.Text.Split('\n')) { if (l.Contains("#")) { Code_Box.Select(len + l.IndexOf('#') + 1, l.Split('#')[1].Length + 1); Code_Box.SelectionColor = Color.Gray; Code_Box.SelectionStart = start_index; Code_Box.SelectionLength = 0; Code_Box.SelectionColor = Color.Black; } len += l.Length; } }
private void Run_String_Code_Box() { int start_state = Code_Box.SelectionStart; bool tilde = false; for (int i = 0; i < Code_Box.Text.Length; i++) { Code_Box.Select(i, 1); Code_Box.SelectionColor = (tilde) ? Color.Brown : Color.Black; if (Code_Box.Text[i] == '\'') { Code_Box.Select(i, 1); Code_Box.SelectionColor = Color.Brown; tilde = !tilde; } } Code_Box.SelectionStart = start_state; }