15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Discrete scroll positions

Mats Mеnhav -- manhav@connectum.skurup.se
Saturday, November 30, 1996

-- [ From: Mats Manhav * EMC.Ver #2.5.02 ] --

Environment: MSVC 4.2b Windows 95

Hi,
I am building a CScrollView in which I paint lines of text.
I want to make it not possible to scroll parts of lines. I.e the first line
shown should never be allowed to be a half line. 

Anyone has a good idea on how to achieve this.

Mats
--
==========================================================================
Mats Mеnhav (Mats Manhav for 7-bit people)
email:manhav@connectum.skurup.se   WWW: http://connectum.skurup.se/~manhav
FAX:  (int) 46 (0) 414 243 05      Phone: (int) 46 (0) 414 243 05         
==========================================================================




Frank McGeough -- fm@synchrologic.com
Sunday, December 01, 1996

> Environment: MSVC 4.2b Windows 95
> 
> Hi,
> I am building a CScrollView in which I paint lines of text.
> I want to make it not possible to scroll parts of lines. I.e the first
line
> shown should never be allowed to be a half line. 
> 
> Anyone has a good idea on how to achieve this.

Look at the SetScrollSizes method in CScrollView and the
parameter sizeLine. This allows you to set how much scrolling
is done in response to a mouse click in the scroll arrow.

Note:
Assuming you are using MM_TEXT as a mapping mode then you
have the same limitation under Win 95 that Win 3.1 has - 65536
is the maximum vertical size. Assuming an average font height of
15 then you can only display 4369 lines in your view. If it's important
to allow for more lines than this than you have to take over the 
scrolling yourself. 




Mike Blaszczak -- mikeblas@nwlink.com
Sunday, December 01, 1996

At 09:29 11/30/96 -0500, Mats Manhav wrote:

>Environment: MSVC 4.2b Windows 95

>I am building a CScrollView in which I paint lines of text.
>I want to make it not possible to scroll parts of lines. I.e the first line
>shown should never be allowed to be a half line. 

>Anyone has a good idea on how to achieve this.

It's just a matter of rounding.  When you calculate where to start
the offset of your drawing, make sure it ligns up with a specific
line rather than on a particular pixel.

.B ekiM
http://www.nwlink.com/~mikeblas/
I'm afraid I've become some sort of speed freak.
These words are my own. I do not speak on behalf of Microsoft.




Philip Beck -- splinta@cix.compulink.co.uk
Monday, December 02, 1996

In-Reply-To: <199611300831.JAA19301@connectum.skurup.se>
Maybe you could try :

CView::OnDraw(CDC pDC)
{
        CPoint pnt;
        pnt = GetScrollPosition();
        if(pnt.x ==  some sort of mod calc on screen/column width )
        {
                ScrollToPosition();
                return;  // ie don't draw
        }
}

>Environment: MSVC 4.2b Windows 95
>
>Hi,
>I am building a CScrollView in which I paint lines of text.
>I want to make it not possible to scroll parts of lines. I.e the first 
>line shown should never be allowed to be a half line. 
>
>Anyone has a good idea on how to achieve this.
>
>Mats




Greg D. Tighe -- gdt@eng.aisinc.com
Monday, December 02, 1996

How about setting the scrollbar range to be the number of lines in 
your document at any time?  That way the finest granularity of 
vertical scrolling would be one line of text.  The hardest part would 
be updating the scroll range to keep up with the dynamically changing 
number of text lines (especially when cutting/pasting multiple lines 
of text.)

> -- [ From: Mats Manhav * EMC.Ver #2.5.02 ] --
> 
> Environment: MSVC 4.2b Windows 95
> 
> Hi,
> I am building a CScrollView in which I paint lines of text.
> I want to make it not possible to scroll parts of lines. I.e the first line
> shown should never be allowed to be a half line. 
> 
> Anyone has a good idea on how to achieve this.
> 
> Mats
> 

	-Greg Tighe
	Applied Intelligent Systems, Inc.
	Ann Arbor, MI
	gdt@aisinc.com




| Вернуться в корень Архива |