Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 画曲线_C#_Graph - Fatal编程技术网

C# 画曲线

C# 画曲线,c#,graph,C#,Graph,试图画一个二次函数,用户输入a,b,c(ax^2+bx+c)。我已经做了一个计算根的函数,现在我必须试着画这个图。我复制了微软的贝塞尔曲线的例子,它编译了,但没有输出。任何帮助都会很好 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Li

试图画一个二次函数,用户输入a,b,c(ax^2+bx+c)。我已经做了一个计算根的函数,现在我必须试着画这个图。我复制了微软的贝塞尔曲线的例子,它编译了,但没有输出。任何帮助都会很好

    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 graph
      { 
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {

    }

    public void drawBeziers(Pen pen, Point[] coordinates)
    {
    }
    private void quadGraph(PaintEventArgs e)
    {
      Pen blackPen = new Pen(Color.Black, 3);

      Point start = new Point(100, 100);
      Point control1 = new Point(200, 10);
      Point control2 = new Point(350, 50);
      Point end1 = new Point(500, 100);
      Point control3 = new Point(600, 150);
      Point control4 = new Point(650, 250);
      Point end2 = new Point(500, 300);
      Point[] bezierPoints = 
                 {
                     start, control1, control2, end1, 
                     control3, control4, end2
                 };

      e.Graphics.DrawBeziers(blackPen, bezierPoints);



    }

您甚至不调用quadGraph(),请将其添加到类中:

protected override void OnPaint(PaintEventArgs pe)
{
   base.OnPaint(pe);
   quadGraph(pe);
}
您甚至不调用quadGraph()。。。。