I need some help drawing an oscilloscopes, VC++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Todos
    New Member
    • Mar 2008
    • 1

    I need some help drawing an oscilloscopes, VC++

    Hello,
    Im working with an ultrasonic device and I need to draw a real time wave signal (like an oscilloscope) on a windows form application, I've finished that part but the drawing is to slow, when I move or rezise the drawing gets as faster as I want, so I think it isn't a code problem.

    This is the code:

    Code:
      
    public: void draw_scope(unsigned char* data){
    	int i=0, x1=0, y1=255;
    	float prop;
    	Graphics* g = scope->CreateGraphics();
    	Pen* myPen = new Pen(Color::Red);  				
    	myPen->Width = 1;
    	prop =  (float)scope->Width/TBuffer;
    	g->ScaleTransform(prop, 1.0f ); 
    	g->Clear(Color::White);
    
    	for (i=0; i<TBuffer; i++) //TBuffer can be from 1 to 8190
    	{   
    		g->DrawLine(myPen, x1,y1 ,i , data[i]); 
    		x1=i;
    		y1=data[i]; 
    	}
    }
    I'm using a timer to call this function (200ms interval), scope is a PictureBox and the timer is activated before the complete signal is plotted.

    Any kind of help is welcome, thank you.

    PS: Please excuse my english ;<.
    PS2: I'm using .net 2003.
    Last edited by Todos; Mar 19 '08, 02:19 PM. Reason: Adding new data
Working...