对话框中有2个CListCtrl控件m_List1, m_List2, 我的目的是通过一个消息使这2个控件切换,就是一个隐藏,另外一个显示。那么我的第一步是移动2个控件到同一位置。我在OnInitDialog函数里这样写的:
CRect rect;
m_List1.GetClientRect(&rect);
m_List1.ClientToScreen(&rect);
this->ScreenToClient(&rect);
m_List2.MoveWindow(rect.left, rect.top, rect.Width(),rect.Height());但是结果发现m_List2的位置要比m_List1的位置deflate 1个象素这是怎么回事?
有什么好的方法解决(请大家不要告诉我inflate 1个象素)
我关键想知道为什么deflate 1个象素
CRect rect;
m_List1.GetClientRect(&rect);
m_List1.ClientToScreen(&rect);
this->ScreenToClient(&rect);
m_List2.MoveWindow(rect.left, rect.top, rect.Width(),rect.Height());但是结果发现m_List2的位置要比m_List1的位置deflate 1个象素这是怎么回事?
有什么好的方法解决(请大家不要告诉我inflate 1个象素)
我关键想知道为什么deflate 1个象素
m_List1.GeWindowRect(&rect2);
你会发现两个的Width和Height不一样(并不是很有的窗口都这样,有“边”的窗口才会!)
GeWindowRect
含义不一样的
m_List1.GetWindowRect(&rect);
this->ScreenToClient(&rect);......
m_List1.MoveWindow(rect);
......
m_List2.MoveWindow(rect);