Re: Client Size - GetClientRect()
Perhaps the GetClibBox() call is just returning the inside dimension since
you would likely erase the borders? You didn't say much about what the
result you're getting represents.
Tom
"bhavacakra" <bhavacakra@googlemail.com> wrote in message
news:1181399612.287635.244420@n4g2000hsb.googlegroups.com...
Hello folks.
When called from CDialogBar::OnCreate(), GetClientRect() is not
returning the size of the CDialogBar as it would when called from
CDialogBar::OnEraseBkgnd(CDC* pDC) with pDC->GetClipBox(); Why and how
to get the full width and height of the CDialogBar upon creation ?
The CDialogBar is actually a class I inherited from CDialogBar. In its
OnCreate() I'm attempting to create a CTabCtrl which takes the whole
width of the bar, but it doesn't work because of the wrong RECT size.
The code looks like this:
afx_msg int Toolbar::OnCreate(LPCREATESTRUCT lpCs) {
if(-1 == TOOLBAR_PARENT::OnCreate(lpCs)) {
TRACE("failed to create toolbar");
return -1;
}
ModifyStyle(WS_CLIPCHILDREN,0);
RECT r;
GetClientRect(&r);
m_tabs.Create(TCS_TABS | WS_CHILD|
WS_VISIBLE ,r,this,IDR_TOOLBARTABS);
m_tabs.InsertItem(0,_T("hello"));
m_tabs.InsertItem(1,_T("world"));
m_tabs.InsertItem(2,_T("world"));
m_tabs.InsertItem(3,_T("world"));
m_tabs.InsertItem(4,_T("world"));
m_tabs.InsertItem(5,_T("world"));
m_tabs.InsertItem(6,_T("world"));
m_tabs.InsertItem(7,_T("world"));
m_tabs.InsertItem(8,_T("world"));
m_tabs.InsertItem(9,_T("world"));
m_tabs.InsertItem(10,_T("world"));
return 0;
}