对话框界面裁剪,SetWindowPos函数,部分显示
我想让一个对话框只显示其右上1/4的东西,就是只显示2,怎么做?
-------------
| | |
| 1 | 2 |
| | |
-------------
| | |
| 3 | 4 |
| | |
-------------
我在其他地方看到了只显示1可以用SetWindowPos实现,这个函数能实现显示2吗?
void CVideoNetDlg::OnButtonClip()
{
// TODO: Add your control notification handler code here
CString str;
if(GetDlgItemText(IDC_BUTTON_CLIP,str),str == "<<")
{
SetDlgItemText(IDC_BUTTON_CLIP,">>"); //IDC_BUTTON_CLIP按钮的ID
}
else
{
SetDlgItemText(IDC_BUTTON_CLIP,"<<");
}
static CRect rectLarge,rectSmall;
if(rectLarge.IsRectNull())
{
CRect rectSeparator1;
GetWindowRect(&rectLarge);
//IDC_SEPARATOR就是1和2中间那条线的ID
GetDlgItem(IDC_SEPARATOR)->GetWindowRect(&rectSeparator1);
rectSmall.left = rectLarge.left;
rectSmall.top = rectLarge.top;
rectSmall.right = rectLarge.right;
rectSmall.bottom = rectSeparator1.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);
}
}