Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.79 KB | None | 0 0
  1. // KREATOR HASEŁ
  2. public partial class Form1 : Form
  3. {
  4.  
  5. public Form1()
  6. {
  7. InitializeComponent();
  8. }
  9.  
  10. private void trackBar1_Scroll(object sender, EventArgs e)
  11. {
  12. int a = trackBar1.Value;
  13. label4.Text = a.ToString();
  14. }
  15.  
  16. private void button1_Click(object sender, EventArgs e)
  17. {
  18. oblicz();
  19. }
  20.  
  21. private void oblicz()
  22. {
  23. int a, b, c, d, e;
  24. a = textBox1.Text.Length;
  25. b = textBox2.Text.Length;
  26. c = textBox3.Text.Length;
  27. d = a + b + c;
  28. e = trackBar1.Value;
  29.  
  30. if (d <= e)
  31. {
  32. int z;
  33. z = trackBar1.Value - d;
  34. Random rnd = new Random();
  35. int num = rnd.Next(1, 6);
  36. if (num == 1)
  37. {
  38. label4.Text = textBox1.Text + textBox2.Text + textBox3.Text;
  39. }
  40. else if (num == 2)
  41. {
  42. label4.Text = textBox2.Text + textBox1.Text + textBox3.Text;
  43. }
  44. else if (num == 3)
  45. {
  46. label4.Text = textBox2.Text + textBox3.Text + textBox1.Text;
  47. }
  48. else if (num == 4)
  49. {
  50. label4.Text = textBox3.Text + textBox2.Text + textBox1.Text;
  51. }
  52. else if (num == 5)
  53. {
  54. label4.Text = textBox1.Text + textBox3.Text + textBox2.Text;
  55. }
  56. else if (num == 6)
  57. {
  58. label4.Text = textBox3.Text + textBox1.Text + textBox2.Text;
  59. }
  60.  
  61. for (int i = 0; i < z; i++)
  62. {
  63. Random rnd1 = new Random();
  64. int num1 = rnd1.Next(0, 9);
  65. label1.Text = label4.Text + num1.ToString();
  66.  
  67. }
  68.  
  69. MessageBox.Show(label4.Text);
  70. File.WriteAllText(@"Pulpit", label4.Text);
  71.  
  72. }
  73. else
  74. {
  75. label4.Text = "Podane frazy maja wiecej liter niz wartosc na suwaku!";
  76.  
  77. }
  78. }
  79. }
  80. }
  81.  
  82.  
  83.  
  84.  
  85. // NOTATNIK ; ZAPIS , ODCZYT , CZCIONKA, KOLOR CZCIONKI
  86.  
  87. public partial class Form1 : Form
  88. {
  89.  
  90.  
  91. public Form1()
  92. {
  93. InitializeComponent();
  94. }
  95.  
  96. private void zapiszJakoToolStripMenuItem_Click(object sender, EventArgs e)
  97. {
  98. SaveFileDialog sv = new SaveFileDialog();
  99. sv.Filter = "Text Documents(*.txt)|*.txt|All Files(*.*)|*.*";
  100. if (sv.ShowDialog() == DialogResult.OK) // ZAPIS
  101. richTextBox1.SaveFile(sv.FileName, RichTextBoxStreamType.PlainText);
  102.  
  103.  
  104. }
  105.  
  106. private void otwórzToolStripMenuItem_Click(object sender, EventArgs e)
  107. {
  108. OpenFileDialog op = new OpenFileDialog();
  109. if (op.ShowDialog() == DialogResult.OK)
  110. richTextBox1.LoadFile(op.FileName, RichTextBoxStreamType.PlainText); // OTWÓRZ
  111. this.Text = op.FileName;
  112.  
  113. }
  114.  
  115. private void czcionkaToolStripMenuItem_Click(object sender, EventArgs e)
  116. {
  117. FontDialog fd = new FontDialog();
  118. fd.Font = richTextBox1.SelectionFont; // CZCIONKA
  119. if (fd.ShowDialog() == DialogResult.OK)
  120. {
  121. richTextBox1.SelectionFont = fd.Font;
  122. }
  123. }
  124.  
  125. private void backgroundColorToolStripMenuItem_Click(object sender, EventArgs e)
  126. {
  127. ColorDialog cr = new ColorDialog(); //KOLOR TŁA
  128. if (cr.ShowDialog() == DialogResult.OK)
  129. {
  130. richTextBox1.BackColor = cr.Color;
  131. }
  132. }
  133.  
  134. private void fontColorToolStripMenuItem_Click(object sender, EventArgs e)
  135. { // KOLOR CZCIONKI
  136. ColorDialog col = new ColorDialog();
  137. col.ShowDialog();
  138. richTextBox1.SelectionColor = col.Color;
  139.  
  140.  
  141. }
  142.  
  143. private void nowyToolStripMenuItem_Click(object sender, EventArgs e)
  144. { // RESET TEKSTU
  145. richTextBox1.ResetText();
  146. }
  147. }
  148. }
  149.  
  150.  
  151. // PROGRAM WITANIA
  152.  
  153. public partial class Form1 : Form
  154. {
  155. string imie;
  156. string przywitanie = "Witaj";
  157. public Form1()
  158. {
  159. InitializeComponent();
  160. }
  161.  
  162. private void button1_Click(object sender, EventArgs e)
  163. {
  164. imie = textBox1.Text;
  165. MessageBox.Show(przywitanie);
  166. }
  167.  
  168. private void powitanie1ToolStripMenuItem_Click(object sender, EventArgs e)
  169. {
  170. przywitanie = "Witaj " + imie;
  171. }
  172.  
  173. private void powitanie1ToolStripMenuItem1_Click(object sender, EventArgs e)
  174. {
  175. przywitanie = "Cześć " + imie;
  176. }
  177.  
  178. private void powitanie1ToolStripMenuItem2_Click(object sender, EventArgs e)
  179. {
  180. przywitanie = "Dzień Dobry " + imie;
  181.  
  182. }
  183.  
  184. private void powitanie1ToolStripMenuItem3_Click(object sender, EventArgs e)
  185. {
  186. przywitanie = "Hello " + imie;
  187. }
  188.  
  189. private void powitanie5ToolStripMenuItem_Click(object sender, EventArgs e)
  190. {
  191. przywitanie = "Guten Tag " + imie;
  192. }
  193. }
  194. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement