help abou drawing a signal wave

  • Thread starter Thread starter Bad_Kid
  • Start date Start date
B

Bad_Kid

(c++) I have to present a wave which is stored in a file (int numbers, I
know sample's freq) on some kind of graph. I've never been using drawing in
c++.
Any suggestions, the easiest way to do that?

thanx...
 
You need to draw your graph on some 'control', typically a form or a panel.
What you want to do is overload its Paint event handler and create your own.
Then grab the Graphics for the control, and use it to draw primitives:

control->Paint += gcnew PaintEventHandler( this,
&MyClass::Paint_Event_Handler ) ;
:
void Paint_Event_Handler( Object^, PaintEventArgs^ e )
{
Graphics^ graphics = e->Graphics ;

graphics ->DrawRectangle(...) ;
graphics ->Draw_Circle(...) ;
etc.
}

One of the primitive methods you can draw with is called DrawCurve( ). This
draws graphs!

Now keep in mind that the Paint event only fires when the control needs to
be re-drawn. Thus, you might at times need to call control->Refresh to force
a Paint event and thereby call your customized Paint event handler to update
the graphics, especially if you make any changes to what is to be drawn.

[==P==]
 
Back
Top