设为首页 加入收藏

TOP

滑鼠(二十一)
2010-12-30 21:11:57 来源: 作者: 【 】 浏览:27886
Tags:滑鼠
n 0 ;
}
hwnd = CreateWindow ( szAppName, TEXT ("Checker2 Mouse Hit-Test Demo"),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hInstance, NULL) ;

ShowWindow (hwnd, iCmdShow) ;
UpdateWindow (hwnd) ;

while ( GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
return msg.wParam ;
}

LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static BOOL fState[DIVISIONS][DIVISIONS] ;
static int cxBlock, cyBlock ;
HDC hdc ;
int x, y ;
PAINTSTRUCT ps ;
POINT point ;
RECT rect ;

switch (message)
{
case WM_SIZE :
cxBlock = LOWORD (lParam) / DIVISIONS ;
cyBlock = HIWORD (lParam) / DIVISIONS ;
return 0 ;

case WM_SETFOCUS :
ShowCursor (TRUE) ;
return 0 ;

case WM_KILLFOCUS :
ShowCursor (FALSE) ;
return 0 ;

case WM_KEYDOWN :
GetCursorPos (&point) ;
ScreenToClient (hwnd, &point) ;
x = max (0, min (DIVISIONS - 1, point.x / cxBlock)) ;
y = max (0, min (DIVISIONS - 1, point.y / cyBlock)) ;

switch (wParam)
{
case VK_UP :
y-- ;
break ;

case VK_DOWN :
y++ ;
首页 上一页 18 19 20 21 22 23 24 下一页 尾页 21/50/50
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇计时器 下一篇键盘

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: