Quoting RBNUBE <[EMAIL PROTECTED]>:
> At this point, the only thing I am having trouble with is determining how to
> size the canvas to allow the text to display.

Why do it that way?

It seems completely backwards to me.

The Canvas is sized according to where it is being used, most likely  
by an external window size that may well be set by the user.

Where you draw text is based on
1) the dimensions of the text, such as the Ascent measured using the  
Graphics class (see the Language Reference).

2) how far the user has scrolled.

So if the sum of TextLogicalYPosition - ScrolledPixels is > 0 and <  
theCanvas.Height then the text is visible.

It is most likely that the document will increase in logical length as  
the user types. Thus, as you are adding lines, the scrollbar will  
increase in logical range (you could regard this as your "virtual  
canvas height"). That just affects how you calculate the effective  
scrolled pixels.

Say you assign your scrollbar a range of 100.

ScrolledPixels = theVertScroll.Value / 100.0 * TotalDocumentHeight

That formula holds whether TotalDocumentHeight is a constant (say just  
one sheet of paper high) or is a value updated every time you add a  
new line as the user types.

regards

Andy
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to