Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2341890
  • 博文数量: 816
  • 博客积分: 10000
  • 博客等级: 上将
  • 技术积分: 5010
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-17 17:57
文章分类

全部博文(816)

文章存档

2011年(1)

2008年(815)

分类:

2008-12-17 18:03:42

void __fastcall TForm1::WndProc(Messages::TMessage &Message)
{
  if(Message.Msg==WM_SIZING)
   {
     RECT *r = (RECT*)Message.LParam;
     int w = ((r->bottom-r->top)*4)/3;
     int h = ((r->right-r->left)*3)/4;
     switch(Message.WParam)
      {
        case WMSZ_LEFT:
        case WMSZ_RIGHT:
             r->top = (r->bottom+r->top-h)/2;
             r->bottom=r->top+h;
             break;
        case WMSZ_TOP:
        case WMSZ_BOTTOM:
             r->left = (r->right+r->left-w)/2;
             r->right=r->left+w;
             break;
        case WMSZ_TOPLEFT:
             if(r->leftright-w)r->left=r->right-w;
             if(r->topbottom-h)r->top=r->bottom-h;
             break;
        case WMSZ_TOPRIGHT:
             if(r->right>r->left+w)r->right=r->left+w;
             if(r->topbottom-h)r->top=r->bottom-h;
             break;
        case WMSZ_BOTTOMLEFT:
             if(r->leftright-w)r->left=r->right-w;
             if(r->bottom>r->top+h)r->bottom=r->top+h;
             break;
        case WMSZ_BOTTOMRIGHT:
             if(r->right>r->left+w)r->right=r->left+w;
             if(r->bottom>r->top+h)r->bottom=r->top+h;
             break;
      }
   }
  TForm::WndProc(Message);
}

--------------------next---------------------

阅读(1017) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~