Setting the height of a list control
wallacechoi@hactl.com.hk
Monday, August 19, 1996
Environment: VC++ 4.0, Win 95
Hi Everybody,
I am trying to double the height of the list control in a form view
with the following code.
CListCtrl* plist = (CListCtrl*) GetDlgItem(IDC_LIST1);
CHeaderCtrl* pHead = (CHeaderCtrl*) plist->GetDlgItem(0);
HD_LAYOUT layout;
pHead->Layout(&layout);
plist->InsertColumn(0,"Some Text", LVCFMT_LEFT, 500,0);
layout.pwpos->cy = layout.pwpos->cy * 2;
CWnd* pWnd = pHead->FromHandle(layout.pwpos->hwndInsertAfter);
pHead->SetWindowPos(pWnd, layout.pwpos->x, layout.pwpos->y,
layout.pwpos->cx, layout.pwpos->cy,
layout.pwpos->flags);
But, I found the SetWindowPos function returns false and the height
have not been set. Have I ignored something or done something wrong??
What is the proper place to put the code??(I have try
OnInitialUpdate() but it cause an assertion error. Currently, I just
place them in OnDraw()).
Thanks for any suggestion.
Wallace PEI,
e-mail:WallaceChoi@hatcl.com.hk
David.Lowndes@bj.co.uk
Wednesday, August 21, 1996
> I am trying to double the height of the list control in a form view
> with the following code...
>
> pHead->SetWindowPos(pWnd, layout.pwpos->x, layout.pwpos->y,
> layout.pwpos->cx, layout.pwpos->cy,
> layout.pwpos->flags);
Wallace,
Have you checked the layout.pwpos->flags? It might contain flags that excluse
the resize operation you'll need. You could try passing:
(SWP_NOACTIVATE| SWP_NOMOVE | SWP_NOZORDER)
Dave Lowndes
MICHAEL@datatree.com
Sunday, August 25, 1996
Here's how I set the height of a CListCtrl from my CMainFrame class:
// Adjust size of ClistCtrl and its frame
CListCtrl* pListCtrl = (CListCtrl*)theApp.mpView->GetListCtrl();
CWnd* pParentFrame = pListCtrl->GetParentFrame();
pParentFrame->MoveWindow(xcoord, ycoord, cx, cy);
Good luck.
> Environment: VC++ 4.0, Win 95
>
> I am trying to double the height of the list control in a form view.
>
Michael Thal michael@datatree.com
Data Tree Corp. http://www.datatree.com
| Вернуться в корень Архива
|