Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace WindowsFormsApp3
- {
- public partial class График : Form
- {
- public График()
- {
- InitializeComponent();
- Draw();
- }
- private void Draw()
- {
- double y = 0;
- double x = 0;
- float X;
- float Y;
- Bitmap bmp = new Bitmap(pictureBox1.Width, pictureBox1.Height);
- Graphics graph = Graphics.FromImage(bmp);
- Pen pen = new Pen(Color.Black);
- pictureBox1.Image = bmp;
- int xc = pictureBox1.Width / 2;
- int yc = pictureBox1.Height / 2;
- graph.DrawLine(pen, pictureBox1.Width / 2, 0, pictureBox1.Width / 2, pictureBox1.Height);
- graph.DrawLine(pen, 0, pictureBox1.Height / 2, pictureBox1.Width, pictureBox1.Height / 2);
- graph.TranslateTransform(xc, yc);
- for (x = -(Math.PI*5); x <= Math.PI*5; x = x + 0.1)
- {
- y = Math.Sin(x);
- X = (float)x*10;
- Y = (float)y*10;
- graph.DrawEllipse(pen, X, Y, 1, 1);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement