Resizing an OLE control
Ballerini Luca -- ballerini@esalab.it Friday, December 13, 1996 Environment: VC++ 4.2b, Win 95, NT 3.51 Hallo, I have a tiny problem with my MDI application. At startup I can't get my OLE control (derived from CWnd) fitting my CFormView (parent of the control) client area. Here is the OnSize overridden of my CFormView class: void CMyFormView::OnSize(UINT nType, int cx, int cy) { CMyFormView::OnSize(nType, cx, cy); // TODO: Add your message handler code here CRect size; GetClientRect(&size); if(IsWindow(m_grid.m_hWnd)) m_grid.MoveWindow(&size);//m_grid is my OLE control } the first time the view is shown, it contains the control not fitting its client area. As soon as I resize the view everything works fine. Any suggestion about? Thanks. ****************************** Ballerini Luca Stefano home: +39 (0)721-479154 ballerini@esalab.it Esalab engineering and service +39 (0)721-414634 ******************************
Syed -- sxs296@psu.edu Monday, December 16, 1996 At 06:48 PM 12/13/96 +0100, you wrote: >Environment: VC++ 4.2b, Win 95, NT 3.51 > >Hallo, >I have a tiny problem with my MDI application. At startup I can't get my OLE >control (derived from CWnd) fitting my CFormView (parent of the control) >client area. >Here is the OnSize overridden of my CFormView class: > >void CMyFormView::OnSize(UINT nType, int cx, int cy) >{ > CMyFormView::OnSize(nType, cx, cy); > > // TODO: Add your message handler code here > > CRect size; > GetClientRect(&size); > > if(IsWindow(m_grid.m_hWnd)) m_grid.MoveWindow(&size);//m_grid is my OLE control What I did was:- CRect size(0,0,cx,cy); if (m_grid.GetSafeHandle()) m_grid.MoveWindows(size); The code above performs flawlessly in my app.
Roma -- roma@neonet.lv Tuesday, December 17, 1996 Luca Ballerini wrote: > > Environment: VC++ 4.2b, Win 95, NT 3.51 > > Hallo, > I have a tiny problem with my MDI application. At startup I can't get my OLE > control (derived from CWnd) fitting my CFormView (parent of the control) > client area. ... > the first time the view is shown, it contains the control not fitting its > client area. > As soon as I resize the view everything works fine. > > Any suggestion about? > Hi! You are probably creating your control in the OnInitialUpdate(), right? During the creation of the MDI child there are two calls to OnSize() member, both BEFORE OnInitialUpdate(). Try to create your control in the OnCreate() right after the call to the base class OnCreate(). At least, I've tried this in my VC 4.0 and it works. BTW, this is kind of new in VC++40. In VC 1.5 and 1.51 one of the OnSize() calls occures AFTER OnInitialUpdate(). -Roman
Cleve -- cleve@buzard.com Wednesday, December 18, 1996 Try doing the size in your OnInitialUpdate. ---------- From: Luca Ballerini[SMTP:ballerini@esalab.it] Sent: Monday, December 16, 1996 3:20 AM To: mfc-l@netcom.com Subject: Resizing an OLE control Environment: VC++ 4.2b, Win 95, NT 3.51 Hallo, I have a tiny problem with my MDI application. At startup I can't get my OLE control (derived from CWnd) fitting my CFormView (parent of the control) client area. Here is the OnSize overridden of my CFormView class: void CMyFormView::OnSize(UINT nType, int cx, int cy) { CMyFormView::OnSize(nType, cx, cy); // TODO: Add your message handler code here CRect size; GetClientRect(&size); if(IsWindow(m_grid.m_hWnd)) m_grid.MoveWindow(&size);//m_grid is my OLE control } the first time the view is shown, it contains the control not fitting its client area. As soon as I resize the view everything works fine. Any suggestion about? Thanks. ****************************** Ballerini Luca Stefano home: +39 (0)721-479154 ballerini@esalab.it Esalab engineering and service +39 (0)721-414634 ******************************
| Вернуться в корень Архива |