2014-01-25 259 views
0

試圖繪製二次函數,其中用戶輸入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); 



    } 
+0

你甚至調用quadGraph()... – thumbmunkeys

回答

0

你甚至不叫quadGraph(),將它添加到您的類:

protected override void OnPaint(PaintEventArgs pe) 
{ 
    base.OnPaint(pe); 
    quadGraph(pe); 
} 
+0

感謝,這就是現在它整理!愚蠢的錯誤。謝謝 – EPicLURcher