Click here to Skip to main content
15,886,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I drew a graph sheet on a windows form, I'm thinking of drawing it on separate control other than the form itself
Posted
Comments
[no name] 28-Aug-14 7:05am    
Okay.... since this is not a question or a problem, you have permission to proceed.
Suvabrata Roy 28-Aug-14 7:22am    
where did you stuck ?
matmape 28-Aug-14 8:36am    
how to plot a linear equation on the graph

1 solution

You can handle the Paint event on individual controls: a form is derived from control, and the Paint event is inherited.

It is very common to handle Paint for Panels and so forth to use them as a substitute for the PictureBox for example - but you can handle Paint for any control, including Buttons, TextBoxes and so forth.

The only thing you may have to do is call Invalidate on the control when you want to update it.
 
Share this answer
 
Comments
matmape 28-Aug-14 8:35am    
I've done that(drew it on a picture box). The main work is how to now plot a linear equation on the drawn graph
Sergey Alexandrovich Kryukov 28-Aug-14 8:40am    
Doing it on a PictureBox is possible but usually makes no sense. This control is redundant and developed to give a simplified way of holding a single fixed image which is already rendered. Rendering your own graphics is much simpler on a "empty" control, which can be a custom control, or Panel...
—SA
Sergey Alexandrovich Kryukov 28-Aug-14 8:40am    
5ed.
—SA
matmape 28-Aug-14 8:42am    
Where do u suggest i draw it onto
Sergey Alexandrovich Kryukov 28-Aug-14 8:53am    
Both ways are fine. If you use a custom control, you can alternatively override OnPaint, which would make your class cleaner.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900