Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void richTextBox1_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (e.KeyChar == (char)Keys.Enter)
- {
- //This is were the code should be
- }
- }
- if (e.KeyChar == (char)Keys.Enter)
- {
- richTextBox1.AppendText("t");
- // Edited After Comment
- var PrevLine = richTextBox2.Lines[richTextBox2.Lines.Count() - 1].ToString();
- var TabsCount = System.Text.RegularExpressions.Regex.Matches(PrevLine, "t").Count;
- }
- if (e.KeyChar == (char)Keys.Enter)
- {
- richTextBox1.AppendText(Environment.NewLine);
- int prevLine = richTextBox1.GetLineFromCharIndex(richTextBox1.SelectionStart) - 1;
- MatchCollection mc = Regex.Matches(richTextBox2.Lines[prevLine], "s+");
- if (mc.Count > 0)
- richTextBox1.AppendText(mc[0].Value);
- e.Handled = true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement