I have a child window, and I created a toolbar by using all the standard stuff. I also created an instance of a grid control.
I followed an example on msdn to make the toolbar work and it works fine but then when I then call GetClientRect to get the grid control to display in the right place, it ignores the tool bar and places the grid control on top of the tool bar.
int CChildFrame::OnCreate(LPCR
EATESTRUCT
lpCreateStruct)
{
if(CMDIChildWnd::OnCreate(
lpCreateSt
ruct)) return 1;
if (!m_wndToolBar.Create(this
) || !m_wndToolBar.LoadToolBar(
IDR_TOOLBA
R1))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
// TODO: Remove this if you don't want tool tips or a
// resizeable toolbar
m_wndToolBar.SetBarStyle(m
_wndToolBa
r.GetBarSt
yle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
// TODO: Delete these three lines if you don't want the toolbar
// to be dockable
m_wndToolBar.EnableDocking
(CBRS_ALIG
N_ANY);
EnableDocking(CBRS_ALIGN_A
NY);
DockControlBar(&m_wndToolB
ar);
CRect clientArea;
GetClientRect(clientArea);
//m_wndToolBar.GetWindowRe
ct(toolbar
Area); <-- I don't think this works
clientArea.top += 30; //toolbarArea.Height();
//AfxMessageBox("toolbarAr
ea.Height(
)");
m_gridDataDisplay.Create(c
lientArea,
this, 1);
m_gridDataDisplay.SetColum
nCount(2);
m_gridDataDisplay.SetRowCo
unt(10);
m_gridDataDisplay.SetAutoS
izeStyle()
;
return 0;
}
Start Free Trial