请教VC的按钮问题
我边的一个按下一个写着缩小的按牛之后,把按钮的文本改成扩大,随之的窗口也缩小,在按时窗口扩大,为什么按下缩小之后,再按就不扩大了那
void Cdlg::OnButton1()
{
// TOD Add your control notification handler code here
CString str;
if(GetDlgItemText(IDC_BUTTON1,str),str=="缩小")
{
SetDlgItemText(IDC_BUTTON1,"扩张");
}
else{
SetDlgItemText(IDC_BUTTON1,"缩小"); }
static CRect rectold;
static CRect rectnew;
CRect p;
GetWindowRect(&rectold);
GetDlgItem(IDC_PIC)->GetWindowRect(&p);
rectnew.top=rectold.top;
rectnew.left=rectold.left;
rectnew.right=rectold.right;
rectnew.bottom=p.bottom;
if(str=="缩小") { SetWindowPos(NULL,0,0,rectnew.Width(),rectnew.Height(),
SWP_NOMOVE|SWP_NOZORDER); }
else
SetWindowPos(NULL,0,0,rectold.Width(),rectold.Height(),
SWP_NOMOVE|SWP_NOZORDER);}