Windows程序设计里第三章的内容
但是有些东西不能理解 大家帮帮忙阿 谢谢! 引用:
case WM_PAINT :
// Prepare the window for painting
hdc = BeginPaint (hwnd, &ps);
// Get vertical scroll bar position
si.cbSize = sizeof (si);
si.fMask = SIF_POS;
GetScrollInfo (hwnd, SB_VERT, &si);
yPos = si.nPos;
// Get horizontal scroll bar position
GetScrollInfo (hwnd, SB_HORZ, &si);
xPos = si.nPos;
// Find painting limits
FirstLine = max (0, yPos + ps.rcPaint.top / yChar);
LastLine = min (LINES - 1, yPos + ps.rcPaint.bottom / yChar);
for (i = FirstLine; i <= LastLine; i++)
{
x = xChar * (1 - xPos);
y = yChar * (i - yPos);
// Note that "55" in the following depends on the
// maximum size of an abc[] item.
//
hr = StringCchLength(abc, 55, abcLength);
if ((FAILED(hr))|(abcLength == NULL))
{
//
// TODO: write error handler
//
}
}
// Indicate that painting is finished
EndPaint (hwnd, &ps);
return 0;
这是MSDN里的例子
FirstLine = max (0, yPos + ps.rcPaint.top / yChar);
LastLine = min (LINES - 1, yPos + ps.rcPaint.bottom / yChar); 这里不懂为什么不直接 =yPos + ps.rcPaint.top / yChar ?还有
x = xChar * (1 - xPos);
y = yChar * (i - yPos); 这个输出坐标 ,怎么理解阿 反正就是不理解Scrol bar 那位帮我详细理解一下 谢谢大家!
虽然你这个窗口能输出20行,但是我就要求是10行呢
虽然你的要求是20行,但是我的窗口最多只能输出10行