|
发表于 2024-10-28 11:16:01
|
显示全部楼层
有大佬帮我看看嘛为啥的问题嘛?
static int cxChar, cyChar,cxCaps, cxClient, cyClient;
我定义了静态变量
case WM_VSCROLL:
hdc = GetDC(hwnd);
//SetTextAlign(hdc, TA_RIGHT | TA_TOP);
switch (wParam & 0Xffff) {
case SB_BOTTOM:
tem = TEXT("我被按了跳到最后。");
TextOut(hdc, cxClient+500, 10, tem, lstrlen(tem));
break;
case SB_LINEUP:
tem = TEXT("我被按了向上一行。");
TextOut(hdc, cxClient + 500, 10, tem, lstrlen(tem));
break;
case SB_LINEDOWN:
tem = TEXT("我被按了向下一行。");
TextOut(hdc, cxClient + 500, 10, tem, lstrlen(tem));
break;
case SB_PAGEUP:
tem = TEXT("我被按了向上一页。");
TextOut(hdc, cxClient + 500, 10, tem, lstrlen(tem));
break;
case SB_PAGEDOWN:
tem = TEXT("我被按了向下一页。");
TextOut(hdc, cxClient + 500, 10, tem, lstrlen(tem));
break;
case SB_TOP:
tem = TEXT("我被按了跳到顶端。");
TextOut(hdc, cxClient + 500, 10, tem, lstrlen(tem));
break;
case SB_THUMBTRACK:
tem = TEXT("别拖着我不放。");
TextOut(hdc, cxClient + 500, 10, tem, lstrlen(tem));
break;
}
ReleaseDC(hwnd, hdc);
case WM_SIZE:
hdc = GetDC(hwnd);
cxClient = LOWORD(lParam);
cyClient = HIWORD(lParam);
StringCchPrintf(strs, 128, L"这个窗口的大小是%d *%d pi.", cxClient, cyClient);
textlen = lstrlen(strs);
TextOut(hdc, 1000, 20, strs, textlen);
ReleaseDC(hwnd, hdc);
我运行后发现,只要我去点击那个滚动条的按键,窗口大小数值就会变0,这样我就无法把输出固定到右上角了 ,这是为啥
|
|