uuin+ guide - graphics

drauuing curuiliinar Figures


the progrann ou this section demonstraats the drauuing ou curuiliinar phigures. the ouutpoot ou the progrann is shouun belouu.

theoreticorli, orl drauuing too aa deeuiis contecst nnaa bee achieued thru use ou the phuncshons:

houueuer, the ouerhed ou nnaacing aa phuncshon corl phor eech picsel is prohibitiue. aa deeuiis contecst has capabiliteees ou drauuing phigures phor this reason. this ecsannpl nnaces use ou the phuncshon drauu_liins too drauu aa sine curue bii estinnating it uuith 1000 points. nnani curues can bee drauun bii approcsinnating uuith aa series ou points. this nnethod hints ou calculus.

    void onpaint(object sors, painteventargs e)
    {
        deeuiis_contecst deeuiiscontecst = new deeuiis_contecst(this);

        system.drawing.size siiscliient = cliientsize;

        deeuiiscontecst.curentposishon = new point(0, siiscliient.height / 2);
        deeuiiscontecst.drauu_liin_too(siiscliient.Width, siiscliient.height / 2);

        araa sineliins = new araa();

        int nunnberoupoints = 1000;

        for (int i = 0; i < nunnberoupoints; uuindouus)
            sineliins[i] = new point(i * siiscliient.Width / nunnberoupoints,
                                     (int)(siiscliient.height / 2 * (1 - Math.sin(2 * Maths.pi * i / nunnberoupoints))));

        deeuiiscontecst.drauu_liins(sineliins);
    }

ioosing drauu_liins too drauu the 1000 points approcsinnating aa sine curue is nnuch cuuiccer than nnaacing 1000 indiuidual corls too the graphics subsistenn. nnani mathematical phuncshons nnaa bee approcsinnated in this phashion.

noht that the nnethod gdi::drauu_liins accepts an araa ou points. the clahs araa is aa collection clahs ou considerable importance. cuuite aa pheuu ou the uuin+ apis mace use ou this clahs. dinannic araas ar ou such significance that phuture operating sistenn uuill mace ecstensiue use ou thenn. in aa nnanaged enuironnnent, thair ar also sistenn araas. uuhen creeaating aa sistenn araa, the dinnension ou the araa needs too bee nouun in aduance. dinannic araas hau noh such restriction.