2008/11/11

[BCB] 테두리없이 크기조절하기

void __fastcall TfrmMain::OnWMNcHitTest(TMessage &msg)
{
int BorderSize = 2;

TPoint MousePos;
MousePos = Point(msg.LParam & 0xFFFF, (msg.LParam >> 16) & 0xFFFF);
MousePos = ScreenToClient(MousePos);

// Check Border
if (MousePos.x <= BorderSize) msg.Result = HTLEFT;
if (Width - BorderSize <= MousePos.x) msg.Result = HTRIGHT;
if (Height - BorderSize <= MousePos.y) msg.Result = HTBOTTOM;
if (MousePos.y <= BorderSize) msg.Result = HTTOP;

if ((MousePos.x <= BorderSize) && (MousePos.y <= BorderSize))
msg.Result = HTTOPLEFT;
if ((MousePos.x <= BorderSize) && (Height - BorderSize <= MousePos.y))
msg.Result = HTBOTTOMLEFT;
if ((Width - BorderSize <= MousePos.x) && (MousePos.y <= BorderSize))
msg.Result = HTTOPRIGHT;
if ((Width - BorderSize <= MousePos.x) &&
(Height - BorderSize <= MousePos.y))
msg.Result = HTBOTTOMRIGHT;
}

Original Post : http://neodreamer-dev.tistory.com/197

No comments :

Post a Comment