MFC w/VC1.52, form view 
Author Message
 MFC w/VC1.52, form view

I have "discovered" form view and want to use it for an application that
uses a dialog box as it primary window.  How do I size the window to
just encompass the dialog?  (I know how to size the window.  What I need
is twofold; 1. how to determine the dialog box's size at run-time, and
2. how to convert between the coordinates of the dialog box to the
screen coordinates of the desktop.)  Thank you.

--
Alex Sokolek

Sorry, due to spamming problems, my eMail address is bogus.
To reply via eMail, please change kelokosa to asokolek.



Wed, 02 Aug 2000 03:00:00 GMT  
 MFC w/VC1.52, form view

You would use ResizeParenttoFit function.  You can look at Q98598 in the
KnowledgeBase (http://www.microsoft.com/kb ) for more details on how and
where to call the function (its different for MDI and SDI apps)

--
Its a big enough umbrella,
  But its always me that ends up getting wet....
 ---------------------------------------------------------------------------
---
| Author for Pinnacle Publishing "Visual C++ Developer"
http://www.pinpub.com/ |
| http://lucifer.lotus.com/jim/main.htm
|
 ---------------------------------------------------------------------------
---



Wed, 02 Aug 2000 03:00:00 GMT  
 MFC w/VC1.52, form view

Jim;

Thank you very much for your prompt answer.  Initially, I thought you
misread my questions, there were two and I thought you only answered
half of one, but when I researched the ResizeParentToFit() API and
followed up on your kb reference I found that your answer was perfect.
Again, thanks.

Quote:

> You would use ResizeParenttoFit function.  You can look at Q98598 in the
> KnowledgeBase (http://www.microsoft.com/kb ) for more details on how and
> where to call the function (its different for MDI and SDI apps)

Alex Sokolek/Project Support
Long Island Lighting Company

{Sorry, due to spamming problems, my return
 address is invalid.  To reply directly,
 please change oclil to lilco.  Thank you.}



Sat, 05 Aug 2000 03:00:00 GMT  
 MFC w/VC1.52, form view

New question:

FormView works just fine now, with size and centering that I specify,
thanks to Jim, but now I want to change the background color.

CWinApp::SetDialogBkColor() does not work as this is not really a
dialog, and the default CFormView::OnDraw() does nothing "as controls
know how to draw themselves".  Any ideas?  Thanks.

--
Alex Sokolek/Project Support
Long Island Lighting Company

{Sorry, due to spamming problems, my return
 address is invalid.  To reply directly,
 please change oclil to lilco.  Thank you.}



Sat, 05 Aug 2000 03:00:00 GMT  
 MFC w/VC1.52, form view


Fri, 19 Jun 1992 00:00:00 GMT  
 MFC w/VC1.52, form view

New question (Corrected):

FormView works just fine now, with size and centering that I specify,
thanks to Jim, but now I want to change the background color.

CWinApp::SetDialogBkColor() does not work as this is not really a
dialog, and the default CFormView::OnDraw() does nothing "as controls
know how to draw themselves".  I think I need to intervene in the window
class registration to change the default brush, but I don't know how.
Any ideas/insights?  Thanks.

--
Alex Sokolek/Project Support
Long Island Lighting Company

{Sorry, due to spamming problems, my return
 address is invalid.  To reply directly,
 please change oclil to lilco.  Thank you.}



Sat, 05 Aug 2000 03:00:00 GMT  
 MFC w/VC1.52, form view

Quote:
> New question (Corrected):

> FormView works just fine now, with size and centering that I specify,
> thanks to Jim, but now I want to change the background color.

> CWinApp::SetDialogBkColor() does not work as this is not really a
> dialog, and the default CFormView::OnDraw() does nothing "as controls
> know how to draw themselves".  I think I need to intervene in the window
> class registration to change the default brush, but I don't know how.
> Any ideas/insights?  Thanks.

Override OnEraseBkgnd(), do your own drawing and return TRUE. This is
normally easier and more flexible than changing the class default brush.

cU
--

                        http://djuga.home.ml.org
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Retriever 1.0 is out:   http://retriever.home.ml.org

Shareware image viewer, thumbnailer & database
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Sat, 05 Aug 2000 03:00:00 GMT  
 MFC w/VC1.52, form view


Fri, 19 Jun 1992 00:00:00 GMT  
 MFC w/VC1.52, form view

Try this code

void CMainView::OnPaint()
{
        RECT rc;  
        CBrush Hbrush;

        CPaintDC dc(this);
        GetClientRect(&rc);
        Hbrush.CreateSolidBrush(RGB(0,255,255));  // what ever color you want
        dc.FillRect(&rc,&Hbrush);
        Hbrush.DeleteObject();

Quote:
}

// called to match control background colors with the screen

HBRUSH CMainView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
        CStDoc *ptr=GetDocument();
        switch(nCtlColor)
        {  
                //case CTLCOLOR_EDIT:     // let the edit controls alone here
                case CTLCOLOR_BTN:
                case CTLCOLOR_STATIC:              
                        pDC->SetBkMode(TRANSPARENT);
                        return ptr->m_hBrush;  // create this as a member
        }              
        return CFormView::OnCtlColor(pDC, pWnd, nCtlColor);

Quote:
}

  vcard.vcf
< 1K Download


Mon, 07 Aug 2000 03:00:00 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Q: How to get the exit point of an MFC dll in VC1.52

2. HELP! Whats wrong with this code?VC1.52

3. Help - How to access MS-ACCess from VC1.52

4. Problem with vc1.52, dos window in win95 and graphics program

5. ldllcew.lib - converting VC1.52 to VC5

6. Help porting VC1.52 DLL to VC2.2 DLL

7. VC1.52 and Win95

8. VC1.52 Setup Install Program

9. Tabbing using VC1.52

10. VC1.52 Compiler optimisation problem

11. VC1.52!!Whats wrong with this??

12. OCX Control in a VC1.52??

 

 
Powered by phpBB® Forum Software