This is really basic to some, but how do I get a program to draw a figure I have an equation for?
Printable View
This is really basic to some, but how do I get a program to draw a figure I have an equation for?
Hook the OnDraw event and paint using a Device Context (DC)
Hmmm... Do you think you could explain that a little simpler? I am quite new to C++ an am not quite sure what you just said! :)
What was stated has nothing to do with C++. It has everything to do with Windows programming. His advice can be used by C, C++, Visual Basic, etc. *Windows* programmers.
Basically, when you want to draw on a window, you need to get something called a "device context" or DC for the window. When you issue Windows functions that draw circles, arcs, bezier curves, lines, etc., you issue them to the DC. To get a device context for the window, calls such as GetDC() are used.
Regards,
Paul McKenzie
In windows, when a control wants to display itself, it must "draw" what you will see. The standard controls do this for you (in the old days, you had to do all of your own drawing.) The control knows when to perform this drawing because it is sent a "draw" event from the operating system. To perform this drawing you need a GDI resource called a device context. To find out more, look up OnDraw and device context or DC in MSDN.
Thanks very much, both of you, could either of you send me a sample of this, or direct me to one?
One way would be to populate a MSGrid control with the x and y values then call the MSGraph control