1. 76.
    0
    using system;
    using system. drawing;
    using system. collections;
    using system. componentmodel;
    using system. windows.forms;
    using system. data;

    namespace çizim_grafik_2
    {
    /// <summary>
    /// summary description for form1.
    /// </summary>
    public class form1 : system. windows.forms. form
    {
    /// <summary>
    /// required designer variable.
    /// </summary>
    private system. componentmodel.container components = null;

    public form1()
    {
    //
    // required for windows form designer support
    //
    initializecomponent();

    //
    // todo: add any constructor code after initializecomponent call
    //
    }

    /// <summary>
    /// clean up any resources being used.
    /// </summary>
    protected override void dispose( bool disposing )
    {
    if( disposing )
    {
    if (components != null)
    {
    components. dispose();
    }
    }
    base. dispose( disposing );
    }

    #region windows form designer generated code
    /// <summary>
    /// required method for designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void initializecomponent()
    {
    //
    // form1
    //
    this. autoscalebasesize = new system. drawing.size(5, 13);
    this. clientsize = new system. drawing.size(292, 266);
    this. name = "form1";
    this. text = "form1";
    this. paint += new system. windows.forms. painteventhandler(this. form1_paint);

    }
    #endregion

    /// <summary>
    /// the main entry point for the application.
    /// </summary>
    [stathread]
    static void main()
    {
    application.run(new form1());
    }

    private float f(float x)
    {
    return (float) (x * math.sin(5 * x * math.pi / 180)); //y=x*sin(5x)
    }

    private void form1_paint(object sender, system. windows.forms. painteventargs e)
    {
    int xorta, yorta, xmax, ymax;
    xorta = this. clientsize.width / 2;
    yorta = this. clientsize.height / 2;
    e.graphics. translatetransform(xorta, yorta);
    xmax = this. clientsize.width;
    ymax = this. clientsize.height;
    //önceki grafiği sil
    e.graphics. clear(this. backcolor);
    //eksenleri çiz
    e.graphics. drawline(new pen(color. blue, 2), -xorta, 0, xorta, 0);//x
    e.graphics. drawline(new pen(color. blue, 2), 0, -yorta, 0, yorta);//y
    float x, y;
    for (x = -xorta ; x<= xorta ; x+= 0.1f)
    {
    //fonksiyonu hesapla
    y = -f(x);
    //o noktaya 1 pixellik çizgi çiz
    e.graphics. drawline(new pen(color.red, 1), x, y, x + 1, y);
    }
    }
    }
    }
    Tümünü Göster
    ···
   tümünü göster