Catharinus van der werf
6/5/2012 1:46:00 PM
Op dinsdag 5 juni 2012 15:11:28 UTC+2 schreef Mayayana het volgende:
> --
> --
> "Catharinus van der werf" <csvanderwerf@gmail.com> wrote in message
> news:e4aa9517-c52e-4fa2-885f-c4c27f718f37@b26g2000vbt.googlegroups.com...
> | Hello my friends
> |
> | I have a vb6--form that contains a richtextbox and a command-button
> | with the capion 'Next Page'. On this form, I want to show the content
> | a a vb-string. The string can vary in length, it could contain 30
> | lines of text, but also 120 or 240 etc.
> | At a certain point I need a new page, that is emptying the richtextbox
> | and fill it with the next part of lines from the string. That should
> | be done by pressing the command-button
> | How can I easily and accurate detect the neccesity for a new page,
> | that contains the next part of the string that I want to show this
> | way.
> |
> Isn't that what the button is for? I read your question
> several times, but I still don't get it. If you mean that
> you need to find out how far down it's scrolled, you can
> use something like the following to get the bottom line
> number and then check the total number of lines by
> using EM_EXLINEFROMCHAR and sending len(RTB.text)
> for the last parameter.
>
> Function GetBottomLine(hRTB as long) As Long '-- hRTB is RTB hWnd
> '--get bottom line number by getting bottom point, then
> '-- getting charfrompos for that point. returns nearest
> '-- line number in high word.(?? supposed to but apparently doesn't.
> '-- seems to only return character offset.)
> Dim Pt1 As Point
> Dim R1 As RECT
> Dim LRet As Long, CPos As Long
> On Error Resume Next
> LRet = SendMessageAny(hRTB, EM_GETRECT, 0&, R1)
> Pt1.X = 1
> Pt1.Y = (R1.Bottom - R1.Top) - 1
> LRet = SendMessageAny(hRTB, EM_CHARFROMPOS, 0&, Pt1)
> GetBottomLine = SendMessageLong(hRTB, EM_EXLINEFROMCHAR, 0&, LRet)
> End Function
Hello Mayayana
I reread me question and indeed I didn't explain good what I want The fact is that I have already created a form like this, but I cannot get the form
show the next part of the string propertly in the richtextbox on the
form after pressing the command button. There are often a couple of empty lines on the next page, sometimes none. This is proberly because I have made a mistake in the sub that I created. The sub contains ao. the following code:
lclmaxlinesonthepagina = 360 / lclFontsize
If lclLineNr = lclmaxlinesonthepagina Or lcllineNr = 2 * (lclmaxlinesonthepagina) Or lclLineNr = 3 * (lclmaxLinesonthepagina) Or lclRegelNr = 4 * (lclmaxLinesonthepagina) Then
For X = 0 To 21
cpTekst = cpTekst & vbCrLf
Next X
In this way the sub puts 22 empty lines in the string cptekst. This 21 empty lines fill the pagebottom and so moves the string to the next page. So what I do in this way is enlarge the string and so let it move to the next page.
Not a good way I guess???
Thanks
Catharinus