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) |