CString str; if(GetDlgItemText(IDC_BUTTON2,str),str=="收缩<<") { str=(_T("扩展>>")); SetDlgItemText(IDC_BUTTON2,str); } else { str=(_T("收缩<<")); SetDlgItemText(IDC_BUTTON2,str); } static CRect rectLarge; static CRect rectSmall; if(rectLarge.IsRectEmpty()) { CRect rectSeparator; GetWindowRect(&rectLarge); GetDlgItem(IDC_SEPARATOR)->GetWindowRect(&rectSeparator); rectSmall.left=rectLarge.left; rectSmall.top=rectLarge.top; rectSmall.right=rectLarge.right; rectSmall.bottom=rectSeparator.bottom; } if(str=="收缩<<") { SetWindowPos(NULL,0,0,rectSmall.Width(), rectSmall.Height(),SWP_NOMOVE|SWP_NOZORDER); } else { SetWindowPos(NULL,0,0,rectLarge.Width(), rectLarge.Height(),SWP_NOMOVE|SWP_NOZORDER); }
}