可伸縮的窗口
阿新 • • 發佈:2017-08-23
set otto lar 初始化 item order git spa 配置
##
伸縮窗口的代碼:
void CVbvbDlg::OnButton1() //伸縮窗口 { CString str; if(GetDlgItemText(IDC_BUTTON1,str),str=="收縮<<") { SetDlgItemText(IDC_BUTTON1,"擴展>>"); SetWindowPos(NULL,0,0,rectSmall.Width(),rectSmall.Height(),SWP_NOMOVE | SWP_NOZORDER); //SetWindowPos()函數用於改變窗口的配置;} else { SetDlgItemText(IDC_BUTTON1,"收縮<<"); SetWindowPos(NULL,0,0,rectLarge.Width(),rectLarge.Height(),SWP_NOMOVE | SWP_NOZORDER); } }
初始化時獲取伸縮窗口的尺寸:
CRect rectSeparator; GetWindowRect((&rectLarge)); GetDlgItem(IDC_RIGHT)->GetWindowRect((&rectSeparator)); rectSmall.left=rectLarge.left; rectSmall.top=rectLarge.top; rectSmall.bottom=rectLarge.bottom; rectSmall.right=rectSeparator.left; SetWindowPos(NULL,0,0,rectSmall.Width(),rectSmall.Height(),SWP_NOMOVE | SWP_NOZORDER);
可伸縮的窗口