11 个解决方案
#1
估计那只有自己写代码实现了
#2
这个要自已写代码来实现.
#3
当Border设置为None的时候,窗口的非客户区就被隐藏,只剩下客户区,在这种情况下,只能通过自己的代码来实现了,
这是SDK代码
// Mesage handler for about box.
// 0- wu 1- left ,2 -right
int TestPos(int x,int y,HWND hWnd)
{
RECT rt;
GetClientRect(hWnd,&rt);
int r = 0;
if(x>=rt.right-5 && x<=rt.right+5)
r = 1;
if(y>=rt.bottom-5 && y<=rt.bottom+5)
r |= 2;
return r;
}
LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
static int _moving = 0;
static HCURSOR _hhrMov[3]={LoadCursor(NULL,IDC_SIZEWE),LoadCursor(NULL,IDC_SIZENS),LoadCursor(NULL,IDC_SIZENWSE)};
switch (message)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
break;
case WM_MOUSEMOVE:
if(_moving==3)
{
SetWindowPos(hDlg,NULL,0,0,LOWORD(lParam),HIWORD(lParam),SWP_NOZORDER|SWP_NOMOVE);
SetCursor(_hhrMov[2]);
}
else if(_moving)
{
RECT rt;
GetClientRect(hDlg,&rt);
SetWindowPos(hDlg,NULL,0,0,_moving&1?LOWORD(lParam):rt.right,_moving&2?HIWORD(lParam):rt.bottom,SWP_NOZORDER|SWP_NOMOVE);
SetCursor(_hhrMov[_moving-1]);
}
else
{
int mov = TestPos(LOWORD(lParam),HIWORD(lParam),hDlg);
if(mov)
SetCursor(_hhrMov[mov-1]);
}
break;
case WM_LBUTTONDOWN:
_moving = TestPos(LOWORD(lParam),HIWORD(lParam),hDlg);
if(_moving){
//_pt = {GET_X_LPARAM(lParam,)GET_Y_LPARAM(lParam)};
SetCapture(hDlg);
SetCursor(_hhrMov[_moving-1]);
}
break;
case WM_LBUTTONUP:
if(_moving){
_moving = 0;
ReleaseCapture();
}
break;
}
return FALSE;
}
这是SDK代码
// Mesage handler for about box.
// 0- wu 1- left ,2 -right
int TestPos(int x,int y,HWND hWnd)
{
RECT rt;
GetClientRect(hWnd,&rt);
int r = 0;
if(x>=rt.right-5 && x<=rt.right+5)
r = 1;
if(y>=rt.bottom-5 && y<=rt.bottom+5)
r |= 2;
return r;
}
LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
static int _moving = 0;
static HCURSOR _hhrMov[3]={LoadCursor(NULL,IDC_SIZEWE),LoadCursor(NULL,IDC_SIZENS),LoadCursor(NULL,IDC_SIZENWSE)};
switch (message)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
break;
case WM_MOUSEMOVE:
if(_moving==3)
{
SetWindowPos(hDlg,NULL,0,0,LOWORD(lParam),HIWORD(lParam),SWP_NOZORDER|SWP_NOMOVE);
SetCursor(_hhrMov[2]);
}
else if(_moving)
{
RECT rt;
GetClientRect(hDlg,&rt);
SetWindowPos(hDlg,NULL,0,0,_moving&1?LOWORD(lParam):rt.right,_moving&2?HIWORD(lParam):rt.bottom,SWP_NOZORDER|SWP_NOMOVE);
SetCursor(_hhrMov[_moving-1]);
}
else
{
int mov = TestPos(LOWORD(lParam),HIWORD(lParam),hDlg);
if(mov)
SetCursor(_hhrMov[mov-1]);
}
break;
case WM_LBUTTONDOWN:
_moving = TestPos(LOWORD(lParam),HIWORD(lParam),hDlg);
if(_moving){
//_pt = {GET_X_LPARAM(lParam,)GET_Y_LPARAM(lParam)};
SetCapture(hDlg);
SetCursor(_hhrMov[_moving-1]);
}
break;
case WM_LBUTTONUP:
if(_moving){
_moving = 0;
ReleaseCapture();
}
break;
}
return FALSE;
}
#4
自己响应鼠标消息,加上MoveWindow/SetWindowPos来实现。
#5
给出个思想吧,应该可以实现的,楼主试试
LBUTTONDOWN里边 设置一个变量 例如FLAG当左键点下是为真
LBUTTONUP里边 FLAG=false
MOUSEMOVE里边
crect rect;
取得原先窗口的rect
hWnd->SetWindowPos(NULL,rect.left,rect.top,(point.x-rect.left),(point.y-rect.top))
LBUTTONDOWN里边 设置一个变量 例如FLAG当左键点下是为真
LBUTTONUP里边 FLAG=false
MOUSEMOVE里边
crect rect;
取得原先窗口的rect
hWnd->SetWindowPos(NULL,rect.left,rect.top,(point.x-rect.left),(point.y-rect.top))
#6
这句可以是
AfxGetMainWnd()->SetWindowPos(NULL,rect.left,rect.top,(point.x-rect.left),(point.y-rect.top))(好像是这么写的 ^_^)
AfxGetMainWnd()->SetWindowPos(NULL,rect.left,rect.top,(point.x-rect.left),(point.y-rect.top))(好像是这么写的 ^_^)
#7
****************************************************************
第一幕...
嫦娥和七仙女问楼主:楼主,你能把分给FallInLoveAt2005吗?
楼主:当然,我的分全是他的。
嫦娥和七仙女激动地说:楼主你太伟大了!
接着,她们全部脱光衣服,一个个扑向了楼主。
......从此,楼主过上了被八个仙女共同伺候的性福生活。
****************************************************************
第二幕...
阎王爷问楼主:楼主,你能把分给FallInLoveAt2005吗?
楼主:不,我才不给他。
阎王爷愤怒的说:今晚来我这报道!
......一周过去了,电线杆子和墙上贴满了寻人启事,楼主因不明
原因失踪。一个月后,有人在一个地窖里发现了楼主的尸体,
身边有一块牌匾,上边写着:有分不给FallInLoveAt2005的后果。
****************************************************************
从此,“有分就给FallInLoveAt2005”已成为一个在世上流传已久的佳话
第一幕...
嫦娥和七仙女问楼主:楼主,你能把分给FallInLoveAt2005吗?
楼主:当然,我的分全是他的。
嫦娥和七仙女激动地说:楼主你太伟大了!
接着,她们全部脱光衣服,一个个扑向了楼主。
......从此,楼主过上了被八个仙女共同伺候的性福生活。
****************************************************************
第二幕...
阎王爷问楼主:楼主,你能把分给FallInLoveAt2005吗?
楼主:不,我才不给他。
阎王爷愤怒的说:今晚来我这报道!
......一周过去了,电线杆子和墙上贴满了寻人启事,楼主因不明
原因失踪。一个月后,有人在一个地窖里发现了楼主的尸体,
身边有一块牌匾,上边写着:有分不给FallInLoveAt2005的后果。
****************************************************************
从此,“有分就给FallInLoveAt2005”已成为一个在世上流传已久的佳话
#8
大家的建议都很好,正在验证中。。。
#9
这儿是另外一种稍微简单一点的方法:
http://sluttery.spaces.live.com/blog/cns!3569FEA80C717FD4!3531.entry
http://sluttery.spaces.live.com/blog/cns!3569FEA80C717FD4!3531.entry
#10
To:dandycheung(珠穆朗玛)
多谢指点!
多谢指点!
#11
我可以完全帮你实现,只要实现WM_NCHITTEST,WM_SETCURSOR,WM_NCLBUTTONDOWN这几个消息就行了
UINT CXXXDlg::OnNcHitTest(UINT nHitTest, CPoint point)
{
CRect rect;
GetWindowRect(&rect);
if(point.x <= rect.left+3)
return HTLEFT;
else if(point.x >= rect.right-3)
return HTRIGHT;
else if(point.y <= rect.top+3)
return HTTOP;
else if(point.y >= rect.bottom-3)
return HTBOTTOM;
else if(point.x <= rect.left+10 && point.y <= rect.top+10)
return HTTOPLEFT;
else if(point.x >= rect.right-10 && point.y <= rect.top+10)
return HTTOPRIGHT;
else if(point.x <= rect.left+10 && point.y >= rect.bottom-10)
return HTBOTTOMLEFT;
else if(point.x >= rect.right-10 && point.y >= rect.bottom-10)
return HTBOTTOMRIGHT;
else
return 0;
}
BOOL CXXXDlg::OnSetCursor(HWND hWnd, UINT nHitTest, UINT message)
{
if(nHitTest == HTCAPTION || nHitTest == HTSYSMENU ||
nHitTest == HTMENU || nHitTest == HTCLIENT)
{
SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)));
}
else if(nHitTest == HTTOP || nHitTest == HTBOTTOM)
{
SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZENS)));
}
else if(nHitTest == HTLEFT || nHitTest == HTRIGHT)
{
SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZEWE)));
}
else if(nHitTest == HTTOPLEFT || nHitTest == HTBOTTOMRIGHT)
{
SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZENWSE)));
}
else if(nHitTest == HTTOPRIGHT || nHitTest == HTBOTTOMLEFT)
{
SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZENESW)));
}
else
{
SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)));
}
}
void CXXXDlg::OnNcLButtonDown(UINT nHitTest, CPoint point)
{
if(nHitTest == HTTOP)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_TOP, MAKELPARAM(point.x, point.y));
else if(nHitTest == HTBOTTOM)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_BOTTOM, MAKELPARAM(point.x, point.y));
else if(nHitTest == HTLEFT)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_LEFT, MAKELPARAM(point.x, point.y));
else if(nHitTest == HTRIGHT)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_RIGHT, MAKELPARAM(point.x, point.y));
else if(nHitTest == HTTOPLEFT)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_TOPLEFT, MAKELPARAM(point.x, point.y));
else if(nHitTest == HTTOPRIGHT)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_TOPRIGHT, MAKELPARAM(point.x, point.y));
else if(nHitTest == HTBOTTOMLEFT)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_BOTTOMLEFT, MAKELPARAM(point.x, point.y));
else if(nHitTest == HTBOTTOMRIGHT)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_BOTTOMRIGHT, MAKELPARAM(point.x, point.y));}
UINT CXXXDlg::OnNcHitTest(UINT nHitTest, CPoint point)
{
CRect rect;
GetWindowRect(&rect);
if(point.x <= rect.left+3)
return HTLEFT;
else if(point.x >= rect.right-3)
return HTRIGHT;
else if(point.y <= rect.top+3)
return HTTOP;
else if(point.y >= rect.bottom-3)
return HTBOTTOM;
else if(point.x <= rect.left+10 && point.y <= rect.top+10)
return HTTOPLEFT;
else if(point.x >= rect.right-10 && point.y <= rect.top+10)
return HTTOPRIGHT;
else if(point.x <= rect.left+10 && point.y >= rect.bottom-10)
return HTBOTTOMLEFT;
else if(point.x >= rect.right-10 && point.y >= rect.bottom-10)
return HTBOTTOMRIGHT;
else
return 0;
}
BOOL CXXXDlg::OnSetCursor(HWND hWnd, UINT nHitTest, UINT message)
{
if(nHitTest == HTCAPTION || nHitTest == HTSYSMENU ||
nHitTest == HTMENU || nHitTest == HTCLIENT)
{
SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)));
}
else if(nHitTest == HTTOP || nHitTest == HTBOTTOM)
{
SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZENS)));
}
else if(nHitTest == HTLEFT || nHitTest == HTRIGHT)
{
SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZEWE)));
}
else if(nHitTest == HTTOPLEFT || nHitTest == HTBOTTOMRIGHT)
{
SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZENWSE)));
}
else if(nHitTest == HTTOPRIGHT || nHitTest == HTBOTTOMLEFT)
{
SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZENESW)));
}
else
{
SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)));
}
}
void CXXXDlg::OnNcLButtonDown(UINT nHitTest, CPoint point)
{
if(nHitTest == HTTOP)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_TOP, MAKELPARAM(point.x, point.y));
else if(nHitTest == HTBOTTOM)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_BOTTOM, MAKELPARAM(point.x, point.y));
else if(nHitTest == HTLEFT)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_LEFT, MAKELPARAM(point.x, point.y));
else if(nHitTest == HTRIGHT)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_RIGHT, MAKELPARAM(point.x, point.y));
else if(nHitTest == HTTOPLEFT)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_TOPLEFT, MAKELPARAM(point.x, point.y));
else if(nHitTest == HTTOPRIGHT)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_TOPRIGHT, MAKELPARAM(point.x, point.y));
else if(nHitTest == HTBOTTOMLEFT)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_BOTTOMLEFT, MAKELPARAM(point.x, point.y));
else if(nHitTest == HTBOTTOMRIGHT)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_BOTTOMRIGHT, MAKELPARAM(point.x, point.y));}
#1
估计那只有自己写代码实现了
#2
这个要自已写代码来实现.
#3
当Border设置为None的时候,窗口的非客户区就被隐藏,只剩下客户区,在这种情况下,只能通过自己的代码来实现了,
这是SDK代码
// Mesage handler for about box.
// 0- wu 1- left ,2 -right
int TestPos(int x,int y,HWND hWnd)
{
RECT rt;
GetClientRect(hWnd,&rt);
int r = 0;
if(x>=rt.right-5 && x<=rt.right+5)
r = 1;
if(y>=rt.bottom-5 && y<=rt.bottom+5)
r |= 2;
return r;
}
LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
static int _moving = 0;
static HCURSOR _hhrMov[3]={LoadCursor(NULL,IDC_SIZEWE),LoadCursor(NULL,IDC_SIZENS),LoadCursor(NULL,IDC_SIZENWSE)};
switch (message)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
break;
case WM_MOUSEMOVE:
if(_moving==3)
{
SetWindowPos(hDlg,NULL,0,0,LOWORD(lParam),HIWORD(lParam),SWP_NOZORDER|SWP_NOMOVE);
SetCursor(_hhrMov[2]);
}
else if(_moving)
{
RECT rt;
GetClientRect(hDlg,&rt);
SetWindowPos(hDlg,NULL,0,0,_moving&1?LOWORD(lParam):rt.right,_moving&2?HIWORD(lParam):rt.bottom,SWP_NOZORDER|SWP_NOMOVE);
SetCursor(_hhrMov[_moving-1]);
}
else
{
int mov = TestPos(LOWORD(lParam),HIWORD(lParam),hDlg);
if(mov)
SetCursor(_hhrMov[mov-1]);
}
break;
case WM_LBUTTONDOWN:
_moving = TestPos(LOWORD(lParam),HIWORD(lParam),hDlg);
if(_moving){
//_pt = {GET_X_LPARAM(lParam,)GET_Y_LPARAM(lParam)};
SetCapture(hDlg);
SetCursor(_hhrMov[_moving-1]);
}
break;
case WM_LBUTTONUP:
if(_moving){
_moving = 0;
ReleaseCapture();
}
break;
}
return FALSE;
}
这是SDK代码
// Mesage handler for about box.
// 0- wu 1- left ,2 -right
int TestPos(int x,int y,HWND hWnd)
{
RECT rt;
GetClientRect(hWnd,&rt);
int r = 0;
if(x>=rt.right-5 && x<=rt.right+5)
r = 1;
if(y>=rt.bottom-5 && y<=rt.bottom+5)
r |= 2;
return r;
}
LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
static int _moving = 0;
static HCURSOR _hhrMov[3]={LoadCursor(NULL,IDC_SIZEWE),LoadCursor(NULL,IDC_SIZENS),LoadCursor(NULL,IDC_SIZENWSE)};
switch (message)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
break;
case WM_MOUSEMOVE:
if(_moving==3)
{
SetWindowPos(hDlg,NULL,0,0,LOWORD(lParam),HIWORD(lParam),SWP_NOZORDER|SWP_NOMOVE);
SetCursor(_hhrMov[2]);
}
else if(_moving)
{
RECT rt;
GetClientRect(hDlg,&rt);
SetWindowPos(hDlg,NULL,0,0,_moving&1?LOWORD(lParam):rt.right,_moving&2?HIWORD(lParam):rt.bottom,SWP_NOZORDER|SWP_NOMOVE);
SetCursor(_hhrMov[_moving-1]);
}
else
{
int mov = TestPos(LOWORD(lParam),HIWORD(lParam),hDlg);
if(mov)
SetCursor(_hhrMov[mov-1]);
}
break;
case WM_LBUTTONDOWN:
_moving = TestPos(LOWORD(lParam),HIWORD(lParam),hDlg);
if(_moving){
//_pt = {GET_X_LPARAM(lParam,)GET_Y_LPARAM(lParam)};
SetCapture(hDlg);
SetCursor(_hhrMov[_moving-1]);
}
break;
case WM_LBUTTONUP:
if(_moving){
_moving = 0;
ReleaseCapture();
}
break;
}
return FALSE;
}
#4
自己响应鼠标消息,加上MoveWindow/SetWindowPos来实现。
#5
给出个思想吧,应该可以实现的,楼主试试
LBUTTONDOWN里边 设置一个变量 例如FLAG当左键点下是为真
LBUTTONUP里边 FLAG=false
MOUSEMOVE里边
crect rect;
取得原先窗口的rect
hWnd->SetWindowPos(NULL,rect.left,rect.top,(point.x-rect.left),(point.y-rect.top))
LBUTTONDOWN里边 设置一个变量 例如FLAG当左键点下是为真
LBUTTONUP里边 FLAG=false
MOUSEMOVE里边
crect rect;
取得原先窗口的rect
hWnd->SetWindowPos(NULL,rect.left,rect.top,(point.x-rect.left),(point.y-rect.top))
#6
这句可以是
AfxGetMainWnd()->SetWindowPos(NULL,rect.left,rect.top,(point.x-rect.left),(point.y-rect.top))(好像是这么写的 ^_^)
AfxGetMainWnd()->SetWindowPos(NULL,rect.left,rect.top,(point.x-rect.left),(point.y-rect.top))(好像是这么写的 ^_^)
#7
****************************************************************
第一幕...
嫦娥和七仙女问楼主:楼主,你能把分给FallInLoveAt2005吗?
楼主:当然,我的分全是他的。
嫦娥和七仙女激动地说:楼主你太伟大了!
接着,她们全部脱光衣服,一个个扑向了楼主。
......从此,楼主过上了被八个仙女共同伺候的性福生活。
****************************************************************
第二幕...
阎王爷问楼主:楼主,你能把分给FallInLoveAt2005吗?
楼主:不,我才不给他。
阎王爷愤怒的说:今晚来我这报道!
......一周过去了,电线杆子和墙上贴满了寻人启事,楼主因不明
原因失踪。一个月后,有人在一个地窖里发现了楼主的尸体,
身边有一块牌匾,上边写着:有分不给FallInLoveAt2005的后果。
****************************************************************
从此,“有分就给FallInLoveAt2005”已成为一个在世上流传已久的佳话
第一幕...
嫦娥和七仙女问楼主:楼主,你能把分给FallInLoveAt2005吗?
楼主:当然,我的分全是他的。
嫦娥和七仙女激动地说:楼主你太伟大了!
接着,她们全部脱光衣服,一个个扑向了楼主。
......从此,楼主过上了被八个仙女共同伺候的性福生活。
****************************************************************
第二幕...
阎王爷问楼主:楼主,你能把分给FallInLoveAt2005吗?
楼主:不,我才不给他。
阎王爷愤怒的说:今晚来我这报道!
......一周过去了,电线杆子和墙上贴满了寻人启事,楼主因不明
原因失踪。一个月后,有人在一个地窖里发现了楼主的尸体,
身边有一块牌匾,上边写着:有分不给FallInLoveAt2005的后果。
****************************************************************
从此,“有分就给FallInLoveAt2005”已成为一个在世上流传已久的佳话
#8
大家的建议都很好,正在验证中。。。
#9
这儿是另外一种稍微简单一点的方法:
http://sluttery.spaces.live.com/blog/cns!3569FEA80C717FD4!3531.entry
http://sluttery.spaces.live.com/blog/cns!3569FEA80C717FD4!3531.entry
#10
To:dandycheung(珠穆朗玛)
多谢指点!
多谢指点!
#11
我可以完全帮你实现,只要实现WM_NCHITTEST,WM_SETCURSOR,WM_NCLBUTTONDOWN这几个消息就行了
UINT CXXXDlg::OnNcHitTest(UINT nHitTest, CPoint point)
{
CRect rect;
GetWindowRect(&rect);
if(point.x <= rect.left+3)
return HTLEFT;
else if(point.x >= rect.right-3)
return HTRIGHT;
else if(point.y <= rect.top+3)
return HTTOP;
else if(point.y >= rect.bottom-3)
return HTBOTTOM;
else if(point.x <= rect.left+10 && point.y <= rect.top+10)
return HTTOPLEFT;
else if(point.x >= rect.right-10 && point.y <= rect.top+10)
return HTTOPRIGHT;
else if(point.x <= rect.left+10 && point.y >= rect.bottom-10)
return HTBOTTOMLEFT;
else if(point.x >= rect.right-10 && point.y >= rect.bottom-10)
return HTBOTTOMRIGHT;
else
return 0;
}
BOOL CXXXDlg::OnSetCursor(HWND hWnd, UINT nHitTest, UINT message)
{
if(nHitTest == HTCAPTION || nHitTest == HTSYSMENU ||
nHitTest == HTMENU || nHitTest == HTCLIENT)
{
SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)));
}
else if(nHitTest == HTTOP || nHitTest == HTBOTTOM)
{
SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZENS)));
}
else if(nHitTest == HTLEFT || nHitTest == HTRIGHT)
{
SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZEWE)));
}
else if(nHitTest == HTTOPLEFT || nHitTest == HTBOTTOMRIGHT)
{
SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZENWSE)));
}
else if(nHitTest == HTTOPRIGHT || nHitTest == HTBOTTOMLEFT)
{
SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZENESW)));
}
else
{
SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)));
}
}
void CXXXDlg::OnNcLButtonDown(UINT nHitTest, CPoint point)
{
if(nHitTest == HTTOP)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_TOP, MAKELPARAM(point.x, point.y));
else if(nHitTest == HTBOTTOM)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_BOTTOM, MAKELPARAM(point.x, point.y));
else if(nHitTest == HTLEFT)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_LEFT, MAKELPARAM(point.x, point.y));
else if(nHitTest == HTRIGHT)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_RIGHT, MAKELPARAM(point.x, point.y));
else if(nHitTest == HTTOPLEFT)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_TOPLEFT, MAKELPARAM(point.x, point.y));
else if(nHitTest == HTTOPRIGHT)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_TOPRIGHT, MAKELPARAM(point.x, point.y));
else if(nHitTest == HTBOTTOMLEFT)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_BOTTOMLEFT, MAKELPARAM(point.x, point.y));
else if(nHitTest == HTBOTTOMRIGHT)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_BOTTOMRIGHT, MAKELPARAM(point.x, point.y));}
UINT CXXXDlg::OnNcHitTest(UINT nHitTest, CPoint point)
{
CRect rect;
GetWindowRect(&rect);
if(point.x <= rect.left+3)
return HTLEFT;
else if(point.x >= rect.right-3)
return HTRIGHT;
else if(point.y <= rect.top+3)
return HTTOP;
else if(point.y >= rect.bottom-3)
return HTBOTTOM;
else if(point.x <= rect.left+10 && point.y <= rect.top+10)
return HTTOPLEFT;
else if(point.x >= rect.right-10 && point.y <= rect.top+10)
return HTTOPRIGHT;
else if(point.x <= rect.left+10 && point.y >= rect.bottom-10)
return HTBOTTOMLEFT;
else if(point.x >= rect.right-10 && point.y >= rect.bottom-10)
return HTBOTTOMRIGHT;
else
return 0;
}
BOOL CXXXDlg::OnSetCursor(HWND hWnd, UINT nHitTest, UINT message)
{
if(nHitTest == HTCAPTION || nHitTest == HTSYSMENU ||
nHitTest == HTMENU || nHitTest == HTCLIENT)
{
SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)));
}
else if(nHitTest == HTTOP || nHitTest == HTBOTTOM)
{
SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZENS)));
}
else if(nHitTest == HTLEFT || nHitTest == HTRIGHT)
{
SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZEWE)));
}
else if(nHitTest == HTTOPLEFT || nHitTest == HTBOTTOMRIGHT)
{
SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZENWSE)));
}
else if(nHitTest == HTTOPRIGHT || nHitTest == HTBOTTOMLEFT)
{
SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZENESW)));
}
else
{
SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)));
}
}
void CXXXDlg::OnNcLButtonDown(UINT nHitTest, CPoint point)
{
if(nHitTest == HTTOP)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_TOP, MAKELPARAM(point.x, point.y));
else if(nHitTest == HTBOTTOM)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_BOTTOM, MAKELPARAM(point.x, point.y));
else if(nHitTest == HTLEFT)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_LEFT, MAKELPARAM(point.x, point.y));
else if(nHitTest == HTRIGHT)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_RIGHT, MAKELPARAM(point.x, point.y));
else if(nHitTest == HTTOPLEFT)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_TOPLEFT, MAKELPARAM(point.x, point.y));
else if(nHitTest == HTTOPRIGHT)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_TOPRIGHT, MAKELPARAM(point.x, point.y));
else if(nHitTest == HTBOTTOMLEFT)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_BOTTOMLEFT, MAKELPARAM(point.x, point.y));
else if(nHitTest == HTBOTTOMRIGHT)
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_SIZE | WMSZ_BOTTOMRIGHT, MAKELPARAM(point.x, point.y));}