using System.d2.doc

(21 KB) Pobierz
using System;

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

 

namespace WindowsApplication8

{

    public partial class Form1 : Form

    {

        public Bitmap bm;

        public Form1()

        {

            InitializeComponent();

 

        }

        public void wykres(object sender, PaintEventArgs e)

        {

            Graphics g = this.CreateGraphics();

            Pen p = new Pen(Color.Blue, 2);

            bm = new Bitmap(this.Width, this.Height, g);

            Point pkt = new Point();

            int i = 0;

            while (i < 41)

            {

                double x = -2 * Math.PI + i * Math.PI / 10, y = Math.Asin(x) * Math.Sin(x) / Math.Sqrt(1 + Math.Pow(Math.Sin(x), 2));

                int a = 126 + (int)(20 * x);  int b = 300 - (int)(10 * x);

                listBox1.Items.Add("x=" + x + "  a=" + a);

                listBox1.Items.Add("y=" + y + "  b=" + b);

                listBox1.Items.Add("");

                pkt = new Point(a, b);

                bm.SetPixel(a, b, Color.Black);

                i++;

            }

            g.DrawImage(bm, 0, 0);

            g.DrawLine(p, new Point(0, 300), new Point(200, 300));

        }

    }

}

 

 

...
Zgłoś jeśli naruszono regulamin