Advertisement
Guest User

Untitled

a guest
Jan 20th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 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 WindowsFormsApp4
  12. {
  13. public partial class Form1 : Form
  14. {
  15. public Form1()
  16. {
  17. InitializeComponent();
  18. }
  19.  
  20. private void button1_Click(object sender, EventArgs e)
  21. {
  22.  
  23. }
  24.  
  25. private void toolStripMenuItem1_Click(object sender, EventArgs e)
  26. {
  27.  
  28. }
  29.  
  30. private void zamknijToolStripMenuItem_Click(object sender, EventArgs e)
  31. {
  32. System.Windows.Forms.DialogResult zamknij;
  33. zamknij = MessageBox.Show(" Czy zamknąć ?", "UWAGA!",
  34. MessageBoxButtons.YesNo, MessageBoxIcon.Stop,
  35. MessageBoxDefaultButton.Button1);
  36. if (zamknij == System.Windows.Forms.DialogResult.Yes)
  37. {
  38. Close();
  39.  
  40. }
  41. }
  42.  
  43. private void textBox1_TextChanged(object sender, EventArgs e)
  44. {
  45.  
  46. }
  47.  
  48. private void obliczToolStripMenuItem_Click(object sender, EventArgs e)
  49. {
  50. double U, I, cosy, P, Q, siny,cp,cq,cenap,cenaq;
  51. string CP, CQ;
  52. U = Convert.ToDouble(textBox1.Text);
  53. I = Convert.ToDouble(textBox2.Text);
  54. cosy = Convert.ToDouble(textBox3.Text);
  55. siny = Math.Sqrt(1 - (cosy * cosy));
  56. P = U * I * cosy;
  57. Q = U * I * siny;
  58. textBox4.Text = Convert.ToString(P);
  59. textBox5.Text = Convert.ToString(Q);
  60. cp = P*(0.000012);
  61. cq = Q*(0.0005);
  62. CP = cp.ToString();
  63. CQ = cq.ToString();
  64. if (Q > 500)
  65. MessageBox.Show("Cena za moc czynna wynosi: "+ cp + "\n Cena za moc bierna wynosi: " + cq +);
  66. else
  67. MessageBox.Show("Cena za moc czynna wynosi: CP");
  68.  
  69.  
  70.  
  71.  
  72. }
  73.  
  74. private void label4_Click(object sender, EventArgs e)
  75. {
  76.  
  77. }
  78.  
  79. private void label5_Click(object sender, EventArgs e)
  80. {
  81.  
  82. }
  83. }
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement