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;
using Chart_CSharp;

namespace LessonA23
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        ContourChart chart = null;

        
        public static double myFieldFunction(double x, double y)
        {
            return 1.0 / ((x - 1.0) * (x - 1.0) + y * y + 1.0);
        }

        ChartAncestor.DelegateFieldFunction func = new ChartAncestor.DelegateFieldFunction(myFieldFunction);

        private void Form1_Load(object sender, EventArgs e)
        {
            chart = new ContourChart(this.Handle);

            chart.SetFieldFunction(func);
            chart.SetPlotRange(-3.0, 3.0, -3.0, 3.0);
            chart.SetContourLineNum(25);
            chart.SetContourPrecision(6);

            chart.SetTitle("测试C#等高线图");

        }

        private void Form1_Resize(object sender, EventArgs e)
        {
            chart.ReDraw();
        }
    }
}
