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.Windows.Forms;
- namespace WindowsFormsApplication7
- {
- public partial class Form1 : Form
- {
- public Form2 ok2;
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- double x, y;
- for (x = -Math.PI; x <= Math.PI; x += Math.PI / 180)
- {
- y = Math.Sin(4 * x);
- listBox1.Items.Add("x=" + x.ToString("0,00") + " y=" + y.ToString("0,00"));
- }
- }
- private void button2_Click(object sender, EventArgs e)
- {
- ok2 = new Form2();
- ok2.Show();
- ok2.g = ok2.CreateGraphics();
- Pen p = new Pen(Color.Red,1);
- double x,x1, y,y1;
- int a, a1, b,b1;
- for (x = -Math.PI; x <= Math.PI; x += Math.PI / 180)
- {
- y = Math.Sin(4 * x);
- x1 = x + 1 * Math.PI / 180;
- y1 = Math.Sin(4 * x1);
- a = 314 + (int)(x * 100);
- a1 = 314 + (int)(x1 * 100);
- b = 200 - (int)(y * 200);
- b1 = 200 - (int)(y1 * 200);
- ok2.g.DrawLine(p, a, b, a1, b1);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement