i am drawing a graph. And i dont the graph to be drawn at instance. Instead i want it to be drawn slowly ie. with delay. Also can u tell me how to zoom any particular areas of the graph
Thanx for the replies..
then you could definitely look at the timer class.
You create a timer object and set its interval value. The interval is how many milliseconds occur between 'tick' events. You place code inside an event handler for the 'tick' events and it is processed each time the timer ticks.
You could break down the stages of drawing the graph and then each time the timer ticks you draw the next step.
take a look at this article. You could take this approach; move your code out of the OnPaint event and into methods you can call from your tick event.
How you do it depends on how you want to implement the delay. What kind of graph are you drawing, and how did you want to animate it? Did you want each section (axis/labels/bars/lines/etc) to simply appear one after the other, or did you want it to fade in?
i hv attached a pic of my graph. drawin the graph was not much comple instead the problms like
a) graphics problem ie when the graph is minimized it again starts drawing from the starting when it is maximized.
b) if any other control like button are placed on the form that place remains blank till the graph is completed.
c) i want that wen i move the mouse on the graph the coordinates are displayed...
Also the link u had send me was compleeeetly out my level....i didnt got anything
thanx for the replies
are you drawing this directly onto the form?
You would be better to place it in a picturebox or panel. That way it is seperate from the Form's Paint event and shouldnt interfere with the painting of other controls.
Here is a sample that draws a line graph using a timer. I have put each plotted point into an array and used a bitmap as a graphics buffer to draw each step to. Then each time the tick event fires the next point is plotted.
EDIT - Mistake in code...code removed
by Geekitygeek: Mistake in code...code removed
nooo...its the name of a panel ON the form. As i said, you are better to draw the graph to a control that way you can invalidate panel to refresh the graph without redrawing the whole form. Likewise, the Form can draw all the controls without having to wait for your graph to finish.
For Each ctrl As Control In Me.Controls("pnlMainPanel").Controls
If ctrl.GetType Is GetType(System.Windows.Forms.Panel) Then
For Each subCtrl As Control In ctrl.Controls
If subCtrl.GetType Is GetType(System.Windows.Forms.TextBox) Then
If subCtrl.GetType Is ...