CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2014

    Exclamation 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)

    void CMainFrame::PositionElements()
    	CRect r, r2, r3;
            int mcs = r.Height() - r2.Height();
            mMillChart->MoveWindow(r.right - r2.Width(),r.top + r2.Height(),mcs,mcs);
    Here is the code for the Oncreate() (Note: I have only shown the MillChart creation)
    int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
    	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
    		return -1;
            CRect r1;
            mMillChart = new BoxChartWnd; //BoxChartWnd is a structure
    	mMillChart->mainFrame = this;
    		"Mill box chart",
    		WS_VISIBLE | WS_CHILD,r1,this);


  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003

    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 07:11 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.