How to resize Tab Control??
-
I have an application that is based on TabControl (CFormView), but for now, it appears as the dialog box that did, and I would like that it occupy the window into the framework. How can I do it?
-
I have an application that is based on TabControl (CFormView), but for now, it appears as the dialog box that did, and I would like that it occupy the window into the framework. How can I do it?
You'd call the SetWindowPos[^] member function.
If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun -
You'd call the SetWindowPos[^] member function.
If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von BraunYes I know. This is the method that resize the tabControl [code] void CMyTabCtrl::SetRectangle() { CRect tabRect, itemRect; int nX, nY, nXc, nYc; GetClientRect(&tabRect); GetItemRect(0, &itemRect); nX=itemRect.left; nY=itemRect.bottom+1; nXc=tabRect.right-itemRect.left-1; nYc=tabRect.bottom-nY-1; m_tabPages[0]->SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_SHOWWINDOW); for(int nCount=1; nCount < m_nNumberOfPages; nCount++){ m_tabPages[nCount]->SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW); } } [/code] But I dont know how to get the size of the framework. What parameter I have to change?
-
Yes I know. This is the method that resize the tabControl [code] void CMyTabCtrl::SetRectangle() { CRect tabRect, itemRect; int nX, nY, nXc, nYc; GetClientRect(&tabRect); GetItemRect(0, &itemRect); nX=itemRect.left; nY=itemRect.bottom+1; nXc=tabRect.right-itemRect.left-1; nYc=tabRect.bottom-nY-1; m_tabPages[0]->SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_SHOWWINDOW); for(int nCount=1; nCount < m_nNumberOfPages; nCount++){ m_tabPages[nCount]->SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW); } } [/code] But I dont know how to get the size of the framework. What parameter I have to change?
What do you mean "the size of the framework"?
If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun -
What do you mean "the size of the framework"?
If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von BraunThis is my app http://i54.tinypic.com/1e9qtx.png I'd like TabControl take up all the gray space into the windows MyTabExample1
-
Yes I know. This is the method that resize the tabControl [code] void CMyTabCtrl::SetRectangle() { CRect tabRect, itemRect; int nX, nY, nXc, nYc; GetClientRect(&tabRect); GetItemRect(0, &itemRect); nX=itemRect.left; nY=itemRect.bottom+1; nXc=tabRect.right-itemRect.left-1; nYc=tabRect.bottom-nY-1; m_tabPages[0]->SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_SHOWWINDOW); for(int nCount=1; nCount < m_nNumberOfPages; nCount++){ m_tabPages[nCount]->SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW); } } [/code] But I dont know how to get the size of the framework. What parameter I have to change?
First, you're calling GetClientRect() in the wrong context. GetClientRect() gets "this" windows client rectangle, not the parents'. If you want to get the parents' client rectangle (the framework as you call it), in the context of the child, then call GetParent()->GetClientRect(). The way I would do what you're trying to do is the following: 1. Using the ClassWizard, add a WM_SIZE and WM_CREATE message handler to your View class, or 2. alternatively add ON_WM_SIZE() and ON_WM_CREATE() to your View class's message map and add the following overrides to your View class's header file:
afx\_msg void OnSize(UINT nType, int cx, int cy); afx\_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
4. add the following code (if you used the ClassWizard to add the WM_SIZE and WM_CREATE handlers, then cut and paste the code as appropriate).
void CMyTabExampleView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);m\_myTabs.MoveWindow(0, 0, cx, cy); // TODO: Add your message handler code here
}
int CMyTabExampleView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;CRect rect; GetClientRect(&rect); m\_myTabs.Create(0, rect, this, 9999); m\_myTabs.ShowWindow(SW\_SHOW); return 0;
}
Of course, the style and ID of the "m_myTabs" window needs to be what you need them to be. Adjust accordingly. Hope this helps. Good luck. :-D Call if you need more help.
If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun