RE: Rich Text box masks Line Feed



I tried that, unfortunately GetLineFromCharIndex() returns the UI line, not
the string array line. So, as the text wraps down the page, the
GetLineFromCharIndex() increments even though there has been no CR.

I can calculate this using the Lines().Length property, but surely MS must
have provided a faster and better way to know which line a character is in!

I assume you can't set WordWrap to false - if you can, problem solved.

This is getting ugly, but you could have two rtbs, one with word wrap and
one without. Show the one with wordwrap, calculate from the one without word
wrap, and keep them in sync.

Alternatively, there is the windows api. Sorry, no warranties for what
follows.

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" ( _
ByVal hWnd As IntPtr, _
ByVal wMsg As Integer, _
ByVal wParam As Integer, _
ByVal lParam As Integer) _
As Integer

Const WM_USER As Integer = &H400
Const EM_EXLINEFROMCHAR As Integer = WM_USER + 54
dim l,c as integer ' zero based line number and character number
c = some zero based character index
l = SendMessage(RichTextBox1.Handle, EM_EXLINEFROMCHAR, 0, c)

.



Relevant Pages

  • Re: Logic failure..
    ... > I've been writting a HTML parser and ran into pretty much ... > single buffer and scanning the text 1 character at a time. ... I need to find me a good point to wrap".. ... I end up with extra <url tags> as resizing events occur and ...
    (borland.public.delphi.non-technical)
  • Re: nobr html command
    ... Mozilla gets it right, IE is broken. ... IE seems to be using the pipe character "|" as whitespace, ... allowing text to wrap at a hyphen.) ... navigation is fixed modify the nav bar in a text ...
    (microsoft.public.frontpage.programming)
  • Re: Text Format
    ... Vertical Alignment to Top for those cells? ... > G'Day Mates, ... > the text would wrap up one line. ... What is the character I can type or what ...
    (microsoft.public.mac.office.excel)
  • Re: [PATCH] add a trivial patch style checker
    ... control column), since the cursor may move to the 81th column when ... We do have screens wider than 80 characters, but almost all the time I spend in terminal windows, they are set to 24x80. ... Hence, 80 is "annoying" not only because patches will wrap, but also because in some editors the 80th character will also wrap. ...
    (Linux-Kernel)
  • Re: Wrapping strings
    ... >I have a string containing multiple lines that I would like to put ... >I'd like to wrap each line by the 78th character. ...
    (comp.lang.ruby)