Resizen einer TabCtrl



  • Hallo

    Ich arbeite momentan mit einer DialogBar. Auf der Dialogbar befindet sich eine TabCtrl. Um diese zu resizen bzw die größe zu verändern benutze ich http://www.codeproject.com/dialog/easysize.asp

    Das funktioniert auch wunderbar, aber leider verändert er nicht die größe des Inhaltes vom der TabCtrl selbst:

    Das ist der Dialog bzw Dialogbar, wo sich die TabCTrl befindet

    #include "stdafx.h"
    #include "Sample.h"
    #include "DlgBar.h"
    
    #ifdef _DEBUG
    #define new DEBUG_NEW
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
    #endif
    
    /////////////////////////////////////////////////////////////////////////////
    // Dialogfeld CDlgBar 
    
    CDlgBar::CDlgBar(CWnd* pParent /*=NULL*/)
    	: CDialog(CDlgBar::IDD, pParent)
    {
    //	m_cTabCtrl = NULL;
    	//{{AFX_DATA_INIT(CDlgBar)
    		// HINWEIS: Der Klassen-Assistent fügt hier Elementinitialisierung ein
    	//}}AFX_DATA_INIT
    }
    
    void CDlgBar::DoDataExchange(CDataExchange* pDX)
    {
    	CDialog::DoDataExchange(pDX);
    	//{{AFX_DATA_MAP(CDlgBar)
    	DDX_Control(pDX, IDC_DLG_TAB, m_cTab);
    	//}}AFX_DATA_MAP
    }
    
    BEGIN_MESSAGE_MAP(CDlgBar, CDialog)
    	//{{AFX_MSG_MAP(CDlgBar)
    	ON_WM_SIZE()
    	ON_WM_SIZING()
    	//}}AFX_MSG_MAP
    END_MESSAGE_MAP()
    
    BEGIN_EASYSIZE_MAP(CDlgBar)
    	EASYSIZE(IDC_DLG_TAB,ES_BORDER,ES_BORDER,ES_BORDER,ES_BORDER,0)
    END_EASYSIZE_MAP
    
    /////////////////////////////////////////////////////////////////////////////
    // Behandlungsroutinen für Nachrichten CDlgBar 
    
    BOOL CDlgBar::OnInitDialog() 
    {
    	CDialog::OnInitDialog();
    
    	CRect tabRect;
    
         m_cTab.GetWindowRect(tabRect);
    
         // Set the size and location of the child windows based on the tab control
         m_rSettingsRect.left = 3;
    	m_rSettingsRect.top = 25;
         m_rSettingsRect.right = tabRect.Width()-10;
         m_rSettingsRect.bottom = tabRect.Height();
    
         // Create the child windows for the main window class
         m_dExpDlg.Create(IDD_DLGBAR_EXPLORER, this);
         m_dFarbeDlg.Create(IDD_DLGBAR_FARBEN, this);
    
         // This is redundant with the default value, considering what OnShowWindow does
         ShowWindowNumber(0);
    
         // Set the titles for each tab
         TCITEM tabItem;
         tabItem.mask = TCIF_TEXT;
    
         tabItem.pszText = _T("&Explorer");
         m_cTab.InsertItem(0, &tabItem);
    
         tabItem.pszText = _T("Farben");
         m_cTab.InsertItem(1, &tabItem);
    
    	 INIT_EASYSIZE;
    
    	return TRUE;  // return TRUE unless you set the focus to a control
    	              // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben
    }
    
    void CDlgBar::OnSize(UINT nType, int cx, int cy) 
    {
    	CDialog::OnSize(nType, cx, cy);
    	UPDATE_EASYSIZE;
    }
    
    void CDlgBar::OnSizing(UINT fwSide, LPRECT pRect) 
    {
    	CDialog::OnSizing(fwSide, pRect);
    	EASYSIZE_MINSIZE(280,250,fwSide,pRect);
    }
    

    und hier ist der CDlgBarExplorer, der sich in der TabCtrl befindet:

    #include "stdafx.h"
    #include "Sample.h"
    #include "DlgBarExplorer.h"
    #include <direct.h>
    
    #ifdef _DEBUG
    #define new DEBUG_NEW
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
    #endif
    
    /////////////////////////////////////////////////////////////////////////////
    // Dialogfeld CDlgBarExplorer 
    
    CDlgBarExplorer::CDlgBarExplorer(CWnd* pParent /*=NULL*/)
    	: CDialog(CDlgBarExplorer::IDD, pParent)
    {
    	//{{AFX_DATA_INIT(CDlgBarExplorer)
    		m_strPath = _T("");
    		m_strSelection = _T("");
    	//}}AFX_DATA_INIT
    }
    
    void CDlgBarExplorer::DoDataExchange(CDataExchange* pDX)
    {
    	CDialog::DoDataExchange(pDX);
    	//{{AFX_DATA_MAP(CDlgBarExplorer)
    	DDX_Control(pDX, IDC_EXPLORER_LIST, m_ctrlList);
    	//}}AFX_DATA_MAP
    }
    
    BEGIN_MESSAGE_MAP(CDlgBarExplorer, CDialog)
    	//{{AFX_MSG_MAP(CDlgBarExplorer)
    	ON_WM_SIZE()
    	ON_WM_SIZING()
    	//}}AFX_MSG_MAP
    END_MESSAGE_MAP()
    
    BEGIN_EASYSIZE_MAP(CDlgBarExplorer)
    	EASYSIZE(IDC_EXPLORER_TREE,ES_BORDER,ES_BORDER,ES_BORDER,ES_BORDER,0)
    	EASYSIZE(IDC_EXPLORER_LIST,ES_BORDER,IDC_EXPLORER_TREE,ES_BORDER,ES_BORDER,0)
    END_EASYSIZE_MAP
    
    /////////////////////////////////////////////////////////////////////////////
    // Behandlungsroutinen für Nachrichten CDlgBarExplorer 
    
    BOOL CDlgBarExplorer::OnInitDialog() 
    {
    	CDialog::OnInitDialog();
    
    	TCHAR  szWorkDir[MAX_PATH];
    
    	// TODO: Add extra initialization here
    	// Here we subclass our CDirTreeCtrl
    	if ( !m_ctrlTree.m_hWnd )
    	{
    		if ( m_ctrlTree.SubclassDlgItem( IDC_EXPLORER_TREE, this ) )
    		{			
    			m_ctrlTree.DisplayTree( NULL /*Display all*/, FALSE /* TRUE = Display Files*/ );
    
    			_getcwd( szWorkDir, 256 );
    			// set the Path to the current Work-Directory
    			m_ctrlTree.SetSelPath( szWorkDir );
    		}
    	}
    
    	InitListDir();
    
    	INIT_EASYSIZE;
    
    	return TRUE;  // return TRUE unless you set the focus to a control
    	              // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben
    }
    
    void CDlgBarExplorer::OnSize(UINT nType, int cx, int cy) 
    {
    	CDialog::OnSize(nType, cx, cy);
    	UPDATE_EASYSIZE;
    }
    
    void CDlgBarExplorer::OnSizing(UINT fwSide, LPRECT pRect) 
    {
    	CDialog::OnSizing(fwSide, pRect);
    	EASYSIZE_MINSIZE(280,250,fwSide,pRect);
    }
    

    die TabCtrl verändert er die größe, sobald man den Dialog zieht oder zusammenschiebt. Beim Inhalt jedoch bleibt alles gleich, warum?! Wie übergebe ich CDlgBarExplorer die Erkenntnis, das die größe des Dialogs verändert wird

    gruß
    Thorsten


Anmelden zum Antworten