Advertisement
Guest User

Untitled

a guest
Aug 26th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.01 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace WindowsFormsApplication1
  12. {
  13. public partial class Form1 : Form
  14. {
  15. public Form1()
  16. {
  17. InitializeComponent();
  18. }
  19.  
  20. private void exitToolStripMenuItem_Click(object sender, EventArgs e)
  21. {
  22. Application.Exit();
  23. }
  24.  
  25. private void newToolStripMenuItem_Click(object sender, EventArgs e)
  26. {
  27. richTextBox1.Clear();
  28. this.Text = "New File";
  29. }
  30.  
  31. private void openToolStripMenuItem_Click(object sender, EventArgs e)
  32. {
  33. OpenFileDialog open = new OpenFileDialog();
  34. if (open.ShowDialog() == DialogResult.OK)
  35. {
  36. richTextBox1.LoadFile(open.FileName, RichTextBoxStreamType.PlainText);
  37. }
  38. this.Text = open.FileName;
  39. }
  40.  
  41. private void saveToolStripMenuItem_Click(object sender, EventArgs e)
  42. {
  43. SaveFileDialog save = new SaveFileDialog();
  44. save.Filter="Text Document (*.txt)|*.txt|All Files (*.*)|*.*";
  45. if (save.ShowDialog() == DialogResult.OK)
  46. {
  47. richTextBox1.SaveFile(save.FileName, RichTextBoxStreamType.PlainText);
  48. }
  49. this.Text = save.FileName;
  50. }
  51.  
  52. private void cutToolStripMenuItem_Click(object sender, EventArgs e)
  53. {
  54. richTextBox1.Cut();
  55. }
  56.  
  57. private void copyToolStripMenuItem_Click(object sender, EventArgs e)
  58. {
  59. richTextBox1.Copy();
  60. }
  61.  
  62. private void pasteToolStripMenuItem_Click(object sender, EventArgs e)
  63. {
  64. richTextBox1.Paste();
  65. }
  66.  
  67. private void undoToolStripMenuItem_Click(object sender, EventArgs e)
  68. {
  69. richTextBox1.Undo();
  70. }
  71.  
  72. private void redoToolStripMenuItem_Click(object sender, EventArgs e)
  73. {
  74. richTextBox1.Redo();
  75. }
  76.  
  77. private void fontToolStripMenuItem1_Click(object sender, EventArgs e)
  78. {
  79. FontDialog font = new FontDialog();
  80. font.Font = richTextBox1.SelectionFont;
  81. if (font.ShowDialog() == DialogResult.OK)
  82. {
  83. richTextBox1.SelectionFont = font.Font;
  84. }
  85. }
  86.  
  87. private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
  88. {
  89. MessageBox.Show("Version: 1.1.0\nCreated by: Akkerman Tamás\n\nYou can contact me on e-mail: akkermantamas27@hotmail.com");
  90. }
  91.  
  92. private void textBoxToolStripMenuItem_Click(object sender, EventArgs e)
  93. {
  94. ColorDialog backcolor = new ColorDialog();
  95. if (backcolor.ShowDialog() == DialogResult.OK)
  96. {
  97. richTextBox1.BackColor = backcolor.Color;
  98. }
  99. }
  100.  
  101. private void numbersToolStripMenuItem_Click(object sender, EventArgs e)
  102. {
  103. ColorDialog backcolor = new ColorDialog();
  104. if (backcolor.ShowDialog() == DialogResult.OK)
  105. {
  106. lineNumbers.BackColor = backcolor.Color;
  107. }
  108. }
  109.  
  110. private void patchNotesToolStripMenuItem_Click(object sender, EventArgs e)
  111. {
  112. string file_path = "\\Notepad\\patch.txt";
  113. file_path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + file_path;
  114. System.IO.StreamReader patch = new System.IO.StreamReader(file_path);
  115. MessageBox.Show(patch.ReadToEnd(),"Patch Notes");
  116. }
  117.  
  118. private void TextChange(object sender, EventArgs e)
  119. {
  120. //Allign
  121. int rtbleft = richTextBox1.Left;
  122. int lnleft = lineNumbers.Width;
  123. rtbleft = lnleft; rtbleft++;
  124. richTextBox1.Left = rtbleft;
  125. }
  126. }
  127. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement