CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2000
    Posts
    9

    save / jump to scroll position in a richtextbox

    i'm developing an editor control in VB6 based on a rich text box which syntax highlightd for a programming language. my highlighting subroutine actually inserts the RTF code and replaces the .textRTF property every time it is run.

    the trouble is, this routine sets the cursor position to 1 and scrolls up to the top of the box every time, and i just want it to appear to the user that the contents were colorized, and no scrolling took place.

    is there a way to (possibly using the API):
    - suspend refresh
    - save the number of the first line visible in the rtbox
    - EXECUTE MY HIGHLIGHTING SUBROUTINE
    - jump back to that line number
    - resume refresh

    so that the highlighting looks smooth?


  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: save / jump to scroll position in a richtextbox

    >is there a way to (possibly using the API):
    > suspend refresh
    LockWindowUpdate API
    >- save the number of the first line visible in the rtbox
    Sendmessage(...EM_GETFIRSTVISIBLELINE...)

    >- jump back to that line number
    SendMessage(...EM_SETSEL...)
    >- resume refresh

    LockWindowUpdate again



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured