为控件之间的间隙设置光标
Setting cursor for the gap in between controls
我已经向可执行文件中静态添加了几个 .cur 文件。我可以把它们弄好;
wc.hCursor=LoadCursor(hInstance,MAKEINTRESOURCE(151)); //before registering window class
HCURSOR cursn=LoadCursor(hInstance,MAKEINTRESOURCE(151));
HCURSOR cibeam=LoadCursor(hInstance,MAKEINTRESOURCE(152));
然后我就用我搜索后找到的这个方法;
SetClassLongPtr(GetDlgItem(hwnd,4),GCLP_HCURSOR,LONG_PTR(cursn)); //on a button
SetClassLongPtr(GetDlgItem(hwnd,21),GCLP_HCURSOR,LONG_PTR(cibeam)); //on an edit box
现在自定义游标可以正常工作了。但是有一个问题。当光标指向控件之间的间隙时,它变成默认的 IDC_ARROW as shown here. 如何让这些间隙使用 cursn
?
我发现控件之间的“间隙”被称为 nonclient area
并且像这样设置光标;
case WM_SETCURSOR:
{
if(LOWORD(lParam)!=HTCLIENT) //the opposite of the example documented on MSDN
{
SetCursor(cursn);
return 1;
}
break;
}
它可能不标准并且不受欢迎,但它仍然看起来更好。
我已经向可执行文件中静态添加了几个 .cur 文件。我可以把它们弄好;
wc.hCursor=LoadCursor(hInstance,MAKEINTRESOURCE(151)); //before registering window class
HCURSOR cursn=LoadCursor(hInstance,MAKEINTRESOURCE(151));
HCURSOR cibeam=LoadCursor(hInstance,MAKEINTRESOURCE(152));
然后我就用我搜索后找到的这个方法;
SetClassLongPtr(GetDlgItem(hwnd,4),GCLP_HCURSOR,LONG_PTR(cursn)); //on a button
SetClassLongPtr(GetDlgItem(hwnd,21),GCLP_HCURSOR,LONG_PTR(cibeam)); //on an edit box
现在自定义游标可以正常工作了。但是有一个问题。当光标指向控件之间的间隙时,它变成默认的 IDC_ARROW as shown here. 如何让这些间隙使用 cursn
?
我发现控件之间的“间隙”被称为 nonclient area
并且像这样设置光标;
case WM_SETCURSOR:
{
if(LOWORD(lParam)!=HTCLIENT) //the opposite of the example documented on MSDN
{
SetCursor(cursn);
return 1;
}
break;
}
它可能不标准并且不受欢迎,但它仍然看起来更好。