抽屉功能的实现
实现主对话框的抽屉功能
CRect rectDlg,rectBtn,rectNew;
GetClientRect(&rectDlg);//得到主队框的客户区域
m_btnFriendList.GetClientRect(&rectBtn);//得到一个按钮的客户区域
switch (piFolder)
{
case 0://打开好友列表
rectNew.left = rectDlg.left;
rectNew.top = rectDlg.top + rectBtn.Height();
rectNew.right = rectDlg.right;
rectNew.bottom= rectDlg.bottom - rectBtn.Height() * 3;
m_lstFriendListCtrl.MoveWindow(rectNew,TRUE);//好友
rectNew.left = rectDlg.left;
rectNew.top = rectDlg.bottom - rectBtn.Height() * 3;
rectNew.right = rectDlg.right;
rectNew.bottom= rectDlg.bottom - rectBtn.Height() * 2;
m_btnStrangerList.MoveWindow(rectNew,TRUE);//陌生人
rectNew.left = rectDlg.left;
rectNew.top = rectDlg.bottom - rectBtn.Height() * 2;
rectNew.right = rectDlg.right;
rectNew.bottom= rectDlg.bottom - rectBtn.Height() * 1;
m_btnBlackList.MoveWindow(rectNew,TRUE);//黑名单
m_lstFriendListCtrl.ShowWindow(SW_SHOW);
m_lstStrangerListCtrl.ShowWindow(SW_HIDE);
m_lstBlackListCtrl.ShowWindow(SW_HIDE);
break;
case 1://打开陌生人列表
rectNew.left = rectDlg.left;
rectNew.top = rectDlg.top + rectBtn.Height();
rectNew.right = rectDlg.right;
rectNew.bottom= rectDlg.top + rectBtn.Height() * 2;
m_btnStrangerList.MoveWindow(rectNew,TRUE);
rectNew.left = rectDlg.left;
rectNew.top = rectDlg.top + rectBtn.Height() * 2;
rectNew.right = rectDlg.right;
rectNew.bottom= rectDlg.bottom - rectBtn.Height() * 2;
m_lstStrangerListCtrl.MoveWindow(rectNew,TRUE);
rectNew.left = rectDlg.left;
rectNew.top = rectDlg.bottom - rectBtn.Height() * 2;
rectNew.right = rectDlg.right;
rectNew.bottom= rectDlg.bottom - rectBtn.Height() * 1;
m_btnBlackList.MoveWindow(rectNew,TRUE);
m_lstFriendListCtrl.ShowWindow(SW_HIDE);
m_lstStrangerListCtrl.ShowWindow(SW_SHOW);
m_lstBlackListCtrl.ShowWindow(SW_HIDE);
break;
case 2://打开黑名单列表
rectNew.left = rectDlg.left;
rectNew.top = rectDlg.top + rectBtn.Height();
rectNew.right = rectDlg.right;
rectNew.bottom= rectDlg.top + rectBtn.Height() * 2;
m_btnStrangerList.MoveWindow(rectNew,TRUE);
rectNew.left = rectDlg.left;
rectNew.top = rectDlg.top + rectBtn.Height() * 2;
rectNew.right = rectDlg.right;
rectNew.bottom= rectDlg.top + rectBtn.Height() * 3;
m_btnBlackList.MoveWindow(rectNew,TRUE);
rectNew.left = rectDlg.left;
rectNew.top = rectDlg.top + rectBtn.Height() * 3;
rectNew.right = rectDlg.right;
rectNew.bottom= rectDlg.bottom - rectBtn.Height() * 1;
m_lstBlackListCtrl.MoveWindow(rectNew,TRUE);
m_lstFriendListCtrl.ShowWindow(SW_HIDE);
m_lstStrangerListCtrl.ShowWindow(SW_HIDE);
m_lstBlackListCtrl.ShowWindow(SW_SHOW);
break;
}