May 29th, 2014, 07:34 PM
MFC help: FrameWnd output to Picture Control in Dialog
I am working on a MFC application that I used for Image Analysis. I have a FrameWnd called MillChart that I use to generate an Image. This window is displayed at the run time in the application and not a part of the GUI dialog. It automatically resizes according to the different monitor resolutions and because of this there is a lot of empty space to the right of the MillChart. I was planning to add a picture control in the GUI dialog and redirect whatever is displayed in the MillChart to the Picture Control so that I can place my other elements (checkboxes, scrollbars etc) that I use in my app close to this MillChart and also set the size of the MillChart to a constant size. I am not knowing an efficient way to do this. Kindly help with directions.
Here is the code for positioning the elements (Note: I have only shown the MillChart position)
Here is the code for the Oncreate() (Note: I have only shown the MillChart creation)
CRect r, r2, r3;
int mcs = r.Height() - r2.Height();
mMillChart->MoveWindow(r.right - r2.Width(),r.top + r2.Height(),mcs,mcs);
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
mMillChart = new BoxChartWnd; //BoxChartWnd is a structure
mMillChart->mainFrame = this;
"Mill box chart",
WS_VISIBLE | WS_CHILD,r1,this);
May 30th, 2014, 08:08 AM
Re: MFC help: FrameWnd output to Picture Control in Dialog
I'm having a little trouble understanding what you have going on.
You say you have a FrameWnd called "MillChart", but you show mMillChart which is a BoxChartWnd, which you say is a struct.
You show a CMainFrame Create call which implies an SDI or MDI app, but talk about a GUI Dialog.
Then you say you want to use a Picture Control to render MillChart, which isn't really how picture controls work.
None of that makes much sense to me. From what little I can glean, I suggest perhaps adding a function to your BoxChartWnd that takes a device context as an argument, and let BoxChartWnd render itself onto whatever device context you pass in.
More than that, you'll need to explain your app's architecture more clearly.
Last edited by GCDEF; May 30th, 2014 at 08:11 AM.
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!