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

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

  
'From:   lance_jt  Fri Apr 4, 2003  9:05 am
' set tab spaces in a QRichedit

     CONST WM_USER=&H400
     CONST EM_SETPARAFORMAT=WM_USER+71

     CONST PFM_TABSTOPS=&H10

     TYPE _paraformat
      cbSize AS SHORT
      wPad1 AS SHORT
      dwMask AS DWORD
      wNumbering AS WORD
      wReserved AS WORD
      dxStartIndent AS LONG
      dxRightIndent AS LONG
      dxOffset AS LONG
      wAlignment AS WORD
      cTabCount AS SHORT '--Max Tab Stops=32
      rgxTabs(31) AS LONG
     END TYPE

     DECLARE FUNCTION SendMessageA LIB "user32" ALIAS "SendMessageA" (hwnd _
      AS LONG, wMsg AS LONG, wParam AS LONG, pf AS LONG) AS LONG

     DECLARE SUB SetTabs

     CREATE Form AS QFORM
      Center
      CREATE Edit AS QEDIT
       Align=1
       Text=".5" '--half inch tab stops
      END CREATE
      CREATE Button AS QBUTTON
       Align=1
       CAPTION="Set Tabs"
       OnClick=SetTabs
      END CREATE
      CREATE RichEdit AS QRICHEDIT
       Align=5
       WordWrap=0
       WantTabs=1
       ScrollBars=3
      END CREATE
      SHOWMODAL
     END CREATE

' This sets the tab stops for the paragraph
' that the cursor is in
     SUB SetTabs
      DIM Mem AS QMEMORYSTREAM
      DIM pf AS _paraformat

      Mem.Position=0
      Mem.WriteUdt pf

      pf.cbSize=Mem.Size
      pf.dwMask=PFM_TABSTOPS
      pf.cTabCount=32
'--The tab spaces are measured in twips. 1440 is roughly 1 inch
      TabSpace=VAL(Edit.Text)*1440
      FOR x=0 TO 31
       pf.rgxTabs(x)=TabSpace*x
      NEXT x

      Mem.Position=0
      Mem.WriteUdt pf
      SendMessageA(RichEdit.Handle, EM_SETPARAFORMAT, 0, Mem.Pointer)
      Mem.CLOSE
     END SUB
掌柜推荐
 
 
¥900.00 ·
 
 
¥430.00 ·
 
 
¥1,580.00 ·
 
 
¥1,015.00 ·
 
 
¥750.00 ·
 
 
¥890.00 编辑
© Mon 2024-11-25  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2003-04-04 10:39:42