Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.78 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. public partial class Form1 : Form
  87. {
  88.  
  89.  
  90. public Form1()
  91. {
  92. InitializeComponent();
  93. }
  94.  
  95. private void zapiszJakoToolStripMenuItem_Click(object sender, EventArgs e)
  96. {
  97. SaveFileDialog sv = new SaveFileDialog();
  98. sv.Filter = "Text Documents(*.txt)|*.txt|All Files(*.*)|*.*";
  99. if (sv.ShowDialog() == DialogResult.OK) // ZAPIS
  100. richTextBox1.SaveFile(sv.FileName, RichTextBoxStreamType.PlainText);
  101.  
  102.  
  103. }
  104.  
  105. private void otwórzToolStripMenuItem_Click(object sender, EventArgs e)
  106. {
  107. OpenFileDialog op = new OpenFileDialog();
  108. if (op.ShowDialog() == DialogResult.OK)
  109. richTextBox1.LoadFile(op.FileName, RichTextBoxStreamType.PlainText); // OTWÓRZ
  110. this.Text = op.FileName;
  111.  
  112. }
  113.  
  114. private void czcionkaToolStripMenuItem_Click(object sender, EventArgs e)
  115. {
  116. FontDialog fd = new FontDialog();
  117. fd.Font = richTextBox1.SelectionFont; // CZCIONKA
  118. if (fd.ShowDialog() == DialogResult.OK)
  119. {
  120. richTextBox1.SelectionFont = fd.Font;
  121. }
  122. }
  123.  
  124. private void backgroundColorToolStripMenuItem_Click(object sender, EventArgs e)
  125. {
  126. ColorDialog cr = new ColorDialog(); //KOLOR TŁA
  127. if (cr.ShowDialog() == DialogResult.OK)
  128. {
  129. richTextBox1.BackColor = cr.Color;
  130. }
  131. }
  132.  
  133. private void fontColorToolStripMenuItem_Click(object sender, EventArgs e)
  134. { // KOLOR CZCIONKI
  135. ColorDialog col = new ColorDialog();
  136. col.ShowDialog();
  137. richTextBox1.SelectionColor = col.Color;
  138.  
  139.  
  140. }
  141.  
  142. private void nowyToolStripMenuItem_Click(object sender, EventArgs e)
  143. { // RESET TEKSTU
  144. richTextBox1.ResetText();
  145. }
  146. }
  147. }
  148.  
  149.  
  150. // PROGRAM WITANIA
  151.  
  152. public partial class Form1 : Form
  153. {
  154. string imie;
  155. string przywitanie = "Witaj";
  156. public Form1()
  157. {
  158. InitializeComponent();
  159. }
  160.  
  161. private void button1_Click(object sender, EventArgs e)
  162. {
  163. imie = textBox1.Text;
  164. MessageBox.Show(przywitanie);
  165. }
  166.  
  167. private void powitanie1ToolStripMenuItem_Click(object sender, EventArgs e)
  168. {
  169. przywitanie = "Witaj " + imie;
  170. }
  171.  
  172. private void powitanie1ToolStripMenuItem1_Click(object sender, EventArgs e)
  173. {
  174. przywitanie = "Cześć " + imie;
  175. }
  176.  
  177. private void powitanie1ToolStripMenuItem2_Click(object sender, EventArgs e)
  178. {
  179. przywitanie = "Dzień Dobry " + imie;
  180.  
  181. }
  182.  
  183. private void powitanie1ToolStripMenuItem3_Click(object sender, EventArgs e)
  184. {
  185. przywitanie = "Hello " + imie;
  186. }
  187.  
  188. private void powitanie5ToolStripMenuItem_Click(object sender, EventArgs e)
  189. {
  190. przywitanie = "Guten Tag " + imie;
  191. }
  192. }
  193. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement