Advertisement
TRANSPORTKOLEJOWY

Untitled

Nov 23rd, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 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.Windows.Forms;
  9.  
  10. namespace WindowsFormsApplication7
  11. {
  12. public partial class Form1 : Form
  13. {
  14.  
  15. public Form2 ok2;
  16. public Form1()
  17. {
  18. InitializeComponent();
  19. }
  20.  
  21. private void button1_Click(object sender, EventArgs e)
  22. {
  23. double x, y;
  24. for (x = -Math.PI; x <= Math.PI; x += Math.PI / 180)
  25. {
  26. y = Math.Sin(4 * x);
  27. listBox1.Items.Add("x=" + x.ToString("0,00") + " y=" + y.ToString("0,00"));
  28. }
  29. }
  30.  
  31. private void button2_Click(object sender, EventArgs e)
  32. {
  33. ok2 = new Form2();
  34. ok2.Show();
  35. ok2.g = ok2.CreateGraphics();
  36. Pen p = new Pen(Color.Red,1);
  37. double x,x1, y,y1;
  38. int a, a1, b,b1;
  39. for (x = -Math.PI; x <= Math.PI; x += Math.PI / 180)
  40. {
  41. y = Math.Sin(4 * x);
  42. x1 = x + 1 * Math.PI / 180;
  43. y1 = Math.Sin(4 * x1);
  44. a = 314 + (int)(x * 100);
  45. a1 = 314 + (int)(x1 * 100);
  46. b = 200 - (int)(y * 200);
  47. b1 = 200 - (int)(y1 * 200);
  48.  
  49. ok2.g.DrawLine(p, a, b, a1, b1);
  50.  
  51. }
  52.  
  53. }
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement