c++ - MFC - How to draw pixel waves inside a rectangle -


i new mfc trying learn scratch.

i trying create small dialog based application in vs2012 - mfc.

on dialog window have drawn rectangle (in onpaint event) this.

cpaintdc dc(this); crect background1(10,10,208,92); dc.rectangle(10,10,208,92); 

then filled bacground color. this.

   cbrush brush1;    brush1.createsolidbrush(rgb(2,3,4));    dc.fillrect(background1,&brush1); 

now wanted draw waves in form of pixels continuously inside rectangle.

as of have done is,

bool top = false;     for(i=10,j=92;i<200 && j>10;)     {         pdc->setpixel(i,j,newcolor);         sleep(10);          if(!top)             j-=1;         else             j+=1;         if(j%4==0)         {             i+=1;          }         if(j==12)             top=true;         if(j==90)             top = false;      } 

i drawing pixels straightaway on window, within dimensions rectangle lies. , waves stop reaches right dimension of rect. feel thats not right way it.

i want draw waves inside rectangle , continuosly, when reacahes right end should move left , should continuous.

is there proper way in mfc draw inside rectangle (technically inside object)?

please me out.

the scrollwindow function can used scroll existing graph left. draw new data right of scrolled area. drawing faster if use polyline function instead of drawpixel: polyline draws array of pixels.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -