Advertisement
Guest User

Untitled

a guest
Feb 19th, 2018
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 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 WindowsFormsApp3
  12. {
  13. public partial class График : Form
  14. {
  15. public График()
  16. {
  17. InitializeComponent();
  18. Draw();
  19. }
  20. private void Draw()
  21. {
  22. double y = 0;
  23. double x = 0;
  24. float X;
  25. float Y;
  26. Bitmap bmp = new Bitmap(pictureBox1.Width, pictureBox1.Height);
  27. Graphics graph = Graphics.FromImage(bmp);
  28. Pen pen = new Pen(Color.Black);
  29. pictureBox1.Image = bmp;
  30. int xc = pictureBox1.Width / 2;
  31. int yc = pictureBox1.Height / 2;
  32. graph.DrawLine(pen, pictureBox1.Width / 2, 0, pictureBox1.Width / 2, pictureBox1.Height);
  33. graph.DrawLine(pen, 0, pictureBox1.Height / 2, pictureBox1.Width, pictureBox1.Height / 2);
  34. graph.TranslateTransform(xc, yc);
  35. for (x = -(Math.PI*5); x <= Math.PI*5; x = x + 0.1)
  36. {
  37. y = Math.Sin(x);
  38. X = (float)x*10;
  39. Y = (float)y*10;
  40. graph.DrawEllipse(pen, X, Y, 1, 1);
  41. }
  42. }
  43.  
  44.  
  45.  
  46.  
  47.  
  48. }
  49.  
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement