Guidance
指路人
g.yi.org
software / rapidq / examples / gui / Edit & Richedit / QRichEdit Scroll Synchronized.bas

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
     $TYPECHECK ON
     $INCLUDE "rapidq.inc"

     CONST EM_GETFIRSTVISIBLELINE = &HCE
     CONST EM_SCROLLCARET = &HB7
     DECLARE FUNCTION SendMessagea LIB "user32" ALIAS "SendMessageA"_
      (BYVAL hwnd AS LONG, BYVAL wMsg AS LONG, BYVAL wParam AS LONG,_
      lParam AS LONG) AS LONG
     DECLARE SUB sync

     DIM onscroll AS QTIMER
     onscroll.interval=50
     onscroll.ontimer=sync

     CREATE Form AS QFORM
      CREATE mainedit AS QRICHEDIT
       hidescrollbars=false
       scrollbars=ssboth
       left=41
      END CREATE
      CREATE ruler AS QRICHEDIT
       width=40
      END CREATE
     END CREATE

     DIM t AS INTEGER
     FOR t =0 TO 50
      mainedit.addstrings "line "+STR$(t)
      ruler.addstrings STR$(t)
     NEXT t
     ruler.addstrings STR$(t)
     ruler.addstrings STR$(t+1)

     form.SHOWMODAL

     SUB sync
      DIM oldpos AS INTEGER,position AS INTEGER
      position= SendMessageA(mainedit.Handle, &Hce, 0, 0)
      IF oldpos<>position THEN
       ruler.selstart=LEN(ruler.text)
       SendMessagea(ruler.Handle, &Hb7, 0, 0)
       ruler.selstart=INSTR(ruler.text,STR$(position))
       SendMessagea(ruler.Handle, &Hb7, 0, 0)
       oldpos=position
      END IF
     END SUB
掌柜推荐
 
 
¥477.00 ·
 
 
¥489.00 ·
 
 
¥1,580.00 ·
 
 
¥880.00 ·
 
 
¥908.00 ·
 
 
¥296.00 ·
© Mon 2024-11-25  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2003-03-06 21:08:39