I want to create an application which main window has canvas (or something where I can draw custom things) and some controls, like buttons and edit fields. But I got stuck about how to do it.
I tried to create MFC with SDI, but how to add control to CDC..?
I tried to create one dialog with buttons and edit fields, but which control refers to something I can draw at..?
Please, enlighten me how to do this..
Its been a few years for me, but here goes:
I don’t think that MFC has a specific canvas control. Instead, when I wanted a drawing surface, I added a group box to the form in design mode. I made the group box invisible, so it would not show up at runtime.
In the OnCreate handler for the form view, I created a CWnd, and gave it the size and location of the invisible group box.
I set up an OnPaint message handler for the CWnd, and voila, instant graphics canvas, or a canvas for whatever else you may need.
Now, this was last done five years ago, and MFC may have advanced incrementally since then, but this is the general mechanism.