现在的位置: 首页 > 综合 > 正文

假期第一天,和孙鑫老师学会了怎么扩展和收缩对话框的面板

2013年09月01日 ⁄ 综合 ⁄ 共 657字 ⁄ 字号 评论关闭
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);
	}
}

抱歉!评论已关闭.