Click to See Complete Forum and Search --> : How to draw in a dialog based app


darkwings
March 19th, 2008, 04:55 PM
I'm totally new to GDI (and mostly new to MFC). I am using Visual C++ 6.0.
I have a dialog based application with a CTabCtrl object. There are multiple tabs on the tab control. I want to create a window (or region) on one of the tabs on which I can draw something. I'll mostly be drawing filled polygons.

Can someone suggest where to start? I've read some examples and done a bit of surfing but haven't figured it out yet. If anyone knows of some sample code which does this, that would be great.

Thanks!

ejac
March 21st, 2008, 03:42 PM
I only used MFC once in the very beginning of my education, and we made some kind of simple paint program, but i cant find the documentation or code anywhere.
But i found these, they might be helpfull to you:
http://www.codersource.net/mfc_tutorial_Part3.html
http://msdn2.microsoft.com/en-us/library/hhkhd4xz(VS.80).aspx
http://www.codeguru.com/cpp/controls/controls/chartingandanaloguecontrols/article.php/c5245/ (source code for drawing stuff in mfc as far as i can see)

Mike Harnad
March 25th, 2008, 08:45 AM
Drawing anything on a dialog requires the use of a drawing context (DC). You can obtain the DC for the tab page by using GetDC (). Once you've got the DC, you can use the methods of the DC object to render lines, text, polygons, etc.

I want to create a window (or region) on one of the tabsThis is typically done by using the methods of CTabCtrl. Have a look at About Tab Controls (http://msdn2.microsoft.com/en-us/library/bb760550.aspx) for more info.

CBasicNet
March 26th, 2008, 03:19 AM
If you want to change the look of the tabs, I guess you have to subclass the CTabCtrl class or use this tab (http://www.codeproject.com/KB/MFC/UltimateToolbox_3DTabView.aspx) or other tab controls featured in the articles on CodeGuru or CodeProject which suits your UI needs.