int21h
2011-11-27 17:12:15 UTC
In an editor-like application I want only whole lines being displayed.
Basically this works as I chose font size 12 and use the following
values for SetScrollSizes
SetScrollSizes(MM_TEXT, CSize(630, 16 * pDoc->m_dwLines),
CSize(630, 16 * countLines), // countLines lines in client rect
visible
CSize(630, 16)); // a line will move 16 units
Unfortunately this does not work for moving the slider with the mouse.
With this method it still is
possible to move the lines so that lines are partially (e.g. lower 4
pixels) displayed in the 1st line.
I tried to work around this by overriding OnVScroll (snippet):
::GetScrollInfo(m_hWnd, SB_VERT, &info);
nPos = info.nTrackPos;
nPos &= 0xfffffff0; // slider now only will give back "whole"
lines
But now I run into the problem that the slider (sometimes) cannot be
moved to the end position
(because of the cutting away with 0xff ff ff f0). This also depends on
the size of the client rect.
Do you have any idea how to implement this?
Basically this works as I chose font size 12 and use the following
values for SetScrollSizes
SetScrollSizes(MM_TEXT, CSize(630, 16 * pDoc->m_dwLines),
CSize(630, 16 * countLines), // countLines lines in client rect
visible
CSize(630, 16)); // a line will move 16 units
Unfortunately this does not work for moving the slider with the mouse.
With this method it still is
possible to move the lines so that lines are partially (e.g. lower 4
pixels) displayed in the 1st line.
I tried to work around this by overriding OnVScroll (snippet):
::GetScrollInfo(m_hWnd, SB_VERT, &info);
nPos = info.nTrackPos;
nPos &= 0xfffffff0; // slider now only will give back "whole"
lines
But now I run into the problem that the slider (sometimes) cannot be
moved to the end position
(because of the cutting away with 0xff ff ff f0). This also depends on
the size of the client rect.
Do you have any idea how to implement this?