computer graphics  simple utility curvei make this code in c#.net but i have error and cant fix it in visual studioi need to fix code and i need to make it to draw curve the design is the picture    this is code  using System;using System.Drawing;using System.Windows.Forms; public class FunctionCurveForm : Form{    private PictureBox displayArea;    private TextBox functionInput;    private Button drawButton;    private Label functionLabel;     public FunctionCurveForm()    {        InitializeComponent();    }     private void InitializeComponent()    {            this.displayArea = new System.Windows.Forms.PictureBox();            this.functionInput = new System.Windows.Forms.TextBox();            this.drawButton = new System.Windows.Forms.Button();            this.functionLabel = new System.Windows.Forms.Label();            ((System.ComponentModel.ISupportInitialize)(this.displayArea)).BeginInit();            this.SuspendLayout();            //             // displayArea            //             this.displayArea.BackColor = System.Drawing.Color.White;            this.displayArea.Location = new System.Drawing.Point(10, 10);            this.displayArea.Name = "displayArea";            this.displayArea.Size = new System.Drawing.Size(400, 300);            this.displayArea.TabIndex = 0;            this.displayArea.TabStop = false;            //             // functionInput            //             this.functionInput.Location = new System.Drawing.Point(80, 320);            this.functionInput.Name = "functionInput";            this.functionInput.Size = new System.Drawing.Size(230, 22);            this.functionInput.TabIndex = 2;            //             // drawButton            //             this.drawButton.Location = new System.Drawing.Point(320, 320);            this.drawButton.Name = "drawButton";            this.drawButton.Size = new System.Drawing.Size(90, 22);            this.drawButton.TabIndex = 3;            this.drawButton.Text = "Draw";            //             // functionLabel            //             this.functionLabel.AutoSize = true;            this.functionLabel.Location = new System.Drawing.Point(10, 320);            this.functionLabel.Name = "functionLabel";            this.functionLabel.Size = new System.Drawing.Size(60, 16);            this.functionLabel.TabIndex = 1;            this.functionLabel.Text = "Function:";            //             // FunctionCurveForm            //             this.ClientSize = new System.Drawing.Size(430, 380);            this.Controls.Add(this.displayArea);            this.Controls.Add(this.functionLabel);            this.Controls.Add(this.functionInput);            this.Controls.Add(this.drawButton);            this.Name = "FunctionCurveForm";            this.Text = "Function Curve Drawer";            ((System.ComponentModel.ISupportInitialize)(this.displayArea)).EndInit();            this.ResumeLayout(false);            this.PerformLayout();     }     private void DrawButton_Click(object sender, EventArgs e)    {        DrawFunction();    }     private void DrawFunction()    {        using (Graphics g = this.displayArea.CreateGraphics())        {            g.Clear(Color.White);            Pen pen = new Pen(Color.Black);             for (int x = 0; x < this.displayArea.Width; x++)            {                int y = (int)(100 * Math.Sin(x * 0.05)); // Example function                g.DrawRectangle(pen, x, this.displayArea.Height / 2 - y, 1, 1);            }        }    }     [STAThread]    static void Main()    {        Application.EnableVisualStyles();        Application.SetCompatibleTextRenderingDefault(false);        Application.Run(new FunctionCurveForm());    }}

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

computer graphics 

simple utility curve
i make this code in c#.net but i have error and cant fix it in visual studio

i need to fix code and i need to make it to draw curve 
the design is the picture 

 

this is code 

using System;
using System.Drawing;
using System.Windows.Forms;

public class FunctionCurveForm : Form
{
    private PictureBox displayArea;
    private TextBox functionInput;
    private Button drawButton;
    private Label functionLabel;

    public FunctionCurveForm()
    {
        InitializeComponent();
    }

    private void InitializeComponent()
    {
            this.displayArea = new System.Windows.Forms.PictureBox();
            this.functionInput = new System.Windows.Forms.TextBox();
            this.drawButton = new System.Windows.Forms.Button();
            this.functionLabel = new System.Windows.Forms.Label();
            ((System.ComponentModel.ISupportInitialize)(this.displayArea)).BeginInit();
            this.SuspendLayout();
            // 
            // displayArea
            // 
            this.displayArea.BackColor = System.Drawing.Color.White;
            this.displayArea.Location = new System.Drawing.Point(10, 10);
            this.displayArea.Name = "displayArea";
            this.displayArea.Size = new System.Drawing.Size(400, 300);
            this.displayArea.TabIndex = 0;
            this.displayArea.TabStop = false;
            // 
            // functionInput
            // 
            this.functionInput.Location = new System.Drawing.Point(80, 320);
            this.functionInput.Name = "functionInput";
            this.functionInput.Size = new System.Drawing.Size(230, 22);
            this.functionInput.TabIndex = 2;
            // 
            // drawButton
            // 
            this.drawButton.Location = new System.Drawing.Point(320, 320);
            this.drawButton.Name = "drawButton";
            this.drawButton.Size = new System.Drawing.Size(90, 22);
            this.drawButton.TabIndex = 3;
            this.drawButton.Text = "Draw";
            // 
            // functionLabel
            // 
            this.functionLabel.AutoSize = true;
            this.functionLabel.Location = new System.Drawing.Point(10, 320);
            this.functionLabel.Name = "functionLabel";
            this.functionLabel.Size = new System.Drawing.Size(60, 16);
            this.functionLabel.TabIndex = 1;
            this.functionLabel.Text = "Function:";
            // 
            // FunctionCurveForm
            // 
            this.ClientSize = new System.Drawing.Size(430, 380);
            this.Controls.Add(this.displayArea);
            this.Controls.Add(this.functionLabel);
            this.Controls.Add(this.functionInput);
            this.Controls.Add(this.drawButton);
            this.Name = "FunctionCurveForm";
            this.Text = "Function Curve Drawer";
            ((System.ComponentModel.ISupportInitialize)(this.displayArea)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

    }

    private void DrawButton_Click(object sender, EventArgs e)
    {
        DrawFunction();
    }

    private void DrawFunction()
    {
        using (Graphics g = this.displayArea.CreateGraphics())
        {
            g.Clear(Color.White);
            Pen pen = new Pen(Color.Black);

            for (int x = 0; x < this.displayArea.Width; x++)
            {
                int y = (int)(100 * Math.Sin(x * 0.05)); // Example function
                g.DrawRectangle(pen, x, this.displayArea.Height / 2 - y, 1, 1);
            }
        }
    }

    [STAThread]
    static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new FunctionCurveForm());
    }
}

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Structure chart
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education