How to notify all controls within CTabCtrl what they should be redrawn(should change their size)?

StackOverflow https://stackoverflow.com/questions/16234298

  •  13-04-2022
  •  | 
  •  

Вопрос

I got an instance of MYListCtrl which is derived class from the CListCtrl within CTabCtrl instance. I have implemented onSize method for MYCListCtrl, and mapped it to the WM_SIZE message.

I want to change size of MYListCtrl when window which includes CTabCtrl is resized, resizing should be based on the dimensions of CTabCtrl. How can I notify MYListCtrl what resizing is needed?

Это было полезно?

Решение

You need to implement onsize for the parent, i.e. the tab control. When the tab control.onresize is called it should in turn resize the list control. With setwindopos you can resize your list control. Something like this:

void MyTabControl::OnSize(UINT nType, int cx, int cy)
{
    m_ListControl.SetWindowPos(/*various parameters */);
}
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top