我有9个子窗口。现在每个人都可以在父窗口内的任何方向移动。但是我希望中间的那个只向左,向右,向上和向下移动(但不是对角线!!!)并自动对准中心。我无法弄清楚如何实现它。任何帮助表示赞赏。即使在$('form').validate({
messages: { name:"Enter name",email:"Enter email"},
errorPlacement:{
$.notify({
title: "Error:<br>",
message: this.message
});
}
})
。或者用文字 - 只是解释。
这就是我如何处理子窗口的移动:
C/C++
MoveChildByCenter
.elseif [iMsg] == WM_LBUTTONDOWN
invoke SetCapture, [hwnd]
invoke InvalidateRect, [hwnd], 0, TRUE
xor eax, eax
ret
.elseif [iMsg] == WM_LBUTTONUP
invoke ReleaseCapture
xor eax, eax
ret
.elseif [iMsg] == WM_MOUSEMOVE
.if [wParam] & MK_LBUTTON
movsx eax, word ptr [lParam]
mov [x], eax
movsx eax, word ptr [lParam+2]
mov [y], eax
invoke GetChildCenter, [hwnd], addr center_x, addr center_y
mov eax, [x]
sub eax, CELL_CENTER
add [center_x], eax
mov eax, [y]
sub eax, CELL_CENTER
add [center_y], eax
invoke MoveChildByCenter, [hwnd], [center_x], [center_y]
.endif
xor eax, eax
ret
GetChildCenter(相对于父窗口)
MoveChildByCenter proc hwnd:HWND, x:dword, y:dword
sub [x], CELL_CENTER
sub [y], CELL_CENTER
invoke MoveWindow, [hwnd], [x], [y], CELL_WIDTH, CELL_HEIGHT, TRUE
ret
MoveChildByCenter endp