您的位置:程序门 -> vb -> 基础类



richtextbox行距


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


richtextbox行距[已结贴,结贴人:tanghuawei]
发表于:2007-06-15 09:54:33 楼主
怎样调整richtextbox行距?谢谢!
发表于:2007-06-15 11:20:151楼 得分:0
百度
“随着vb6几个补丁的退出,事实上richtextbox正悄悄发生变化,它已经支持richedit2.0了,所以我们可以设置结构体”
--一个5星的csdn老姜写的。不过我have   not   yet   tested.
发表于:2007-06-15 11:55:212楼 得分:0
這個我已經試過了哦,呵呵,還是謝謝你!
這個可以調整很大的行距,但是不能調小,如果調小就顯示不全了!
发表于:2007-06-15 13:28:023楼 得分:0
public   enum   erecparagraphlinespacingconstants
        erclinespacingsingle   =   0
        erclinespacingoneandahalf   =   1
        erclinespacingdouble   =   2
        erclinespacingtwips   =   3
        erclinespacingtwipsanyminimum   =   4
        erclinespacingtwentiethline   =   5
end   enum

public   sub   setparagraphlinespacing(   byval   elinespacingstyle   as   erecparagraphlinespacingconstants,   byval   yspacing   as   long)

dim   tcf2   as   paraformat2
dim   lr   as   long

                tcf2.dwmask   =   pfm_linespacing
                tcf2.cbsize   =   lenb(tcf2)
                tcf2.blinespacingrule   =   elinespacingstyle
                tcf2.dylinespacing   =   yspacing
                lr   =   sendmessagelong(m_hwnd,   em_setparaformat,   0,   varptr(tcf2))
     
end   sub

public   sub   getparagraphspacing(   byref   lspaceafter   as   long,   byref   lspacebefore   as   long)

dim   tcf2   as   paraformat2
dim   lr   as   long

                tcf2.dwmask   =   pfm_spacebefore   or   pfm_spaceafter
                tcf2.cbsize   =   lenb(tcf2)
                lr   =   sendmessagelong(m_hwnd,   em_getparaformat,   0,   varptr(tcf2))
                lspaceafter   =   tcf2.dyspaceafter
                lspacebefore   =   tcf2.dyspacebefore

end   sub
发表于:2007-06-15 13:30:404楼 得分:0
'怎样调整richtextbox行距?
public   enum   erecparagraphlinespacingconstants
erclinespacingsingle   =   0
erclinespacingoneandahalf   =   1
erclinespacingdouble   =   2
erclinespacingtwips   =   3
erclinespacingtwipsanyminimum   =   4
erclinespacingtwentiethline   =   5
end   enum

public   sub   getparagraphlinespacing(   byref   elinespacingstyle   as   erecparagraphlinespacingconstants,   byref   yspacing   as   long)

dim   tcf2   as   paraformat2
dim   lr   as   long

                tcf2.dwmask   =   pfm_linespacing
                tcf2.cbsize   =   lenb(tcf2)
                lr   =   sendmessagelong(m_hwnd,   em_getparaformat,   0,   varptr(tcf2))
                elinespacingstyle   =   tcf2.blinespacingrule
                yspacing   =   tcf2.dylinespacing
   
end   sub

public   sub   setparagraphlinespacing(   byval   elinespacingstyle   as   erecparagraphlinespacingconstants,   byval   yspacing   as   long)

dim   tcf2   as   paraformat2
dim   lr   as   long

tcf2.dwmask   =   pfm_linespacing
tcf2.cbsize   =   lenb(tcf2)
tcf2.blinespacingrule   =   elinespacingstyle
tcf2.dylinespacing   =   yspacing
lr   =   sendmessagelong(m_hwnd,   em_setparaformat,   0,   varptr(tcf2))

end   sub
发表于:2007-06-15 16:31:435楼 得分:0
'用法:
'   调整richtextbox1行距:
      dim   estyle   as   erecparagraphlinespacingconstants
      dim   yspace   as   long      
      richtextbox1.setparagraphlinespacing   estyle,   yspace

'怎样调整richtextbox行距?
public   enum   erecparagraphlinespacingconstants
erclinespacingsingle   =   0
erclinespacingoneandahalf   =   1
erclinespacingdouble   =   2
erclinespacingtwips   =   3
erclinespacingtwipsanyminimum   =   4
erclinespacingtwentiethline   =   5
end   enum

public   sub   getparagraphlinespacing(   byval   hwnd   as   long,byref   elinespacingstyle   as   erecparagraphlinespacingconstants,   byref   yspacing   as   long)

dim   tcf2   as   paraformat2
dim   lr   as   long

tcf2.dwmask   =   pfm_linespacing
tcf2.cbsize   =   lenb(tcf2)
lr   =   sendmessagelong(hwnd,   em_getparaformat,   0,   varptr(tcf2))
elinespacingstyle   =   tcf2.blinespacingrule
yspacing   =   tcf2.dylinespacing

end   sub

public   sub   setparagraphlinespacing(   byval   hwnd   as   long,byval   elinespacingstyle   as   erecparagraphlinespacingconstants,   byval   yspacing   as   long)

dim   tcf2   as   paraformat2
dim   lr   as   long

tcf2.dwmask   =   pfm_linespacing
tcf2.cbsize   =   lenb(tcf2)
tcf2.blinespacingrule   =   elinespacingstyle
tcf2.dylinespacing   =   yspacing
lr   =   sendmessagelong(hwnd,   em_setparaformat,   0,   varptr(tcf2))

end   sub
发表于:2007-06-15 16:48:396楼 得分:0
根本不能用,我太遲鈍了,請附全部代碼好嗎?謝謝!
发表于:2007-06-15 16:52:237楼 得分:0
'the   code   is   mess.sorry!  
'finalized   (?),please   give   feedback   from   vbadvisor
'用法:

  '调整richtextbox1   paragraph   行距:
      dim   lafteradjust   as   long,   lbeforeadjust   as   long
     
      lafteradjust   =   10
      lbeforeadjust   =   200
      richtextbox1.setparagraphspacing   richtextbox1.hwnd,lafteradjust   ,   lbeforeadjust  


'怎样调整richtextbox行距?
public   enum   erecparagraphlinespacingconstants
erclinespacingsingle   =   0
erclinespacingoneandahalf   =   1
erclinespacingdouble   =   2
erclinespacingtwips   =   3
erclinespacingtwipsanyminimum   =   4
erclinespacingtwentiethline   =   5
end   enum

public   sub   getparagraphlinespacing(   byval   hwnd   as   long,byref   elinespacingstyle   as   erecparagraphlinespacingconstants,   byref   yspacing   as   long)

dim   tcf2   as   paraformat2
dim   lr   as   long

tcf2.dwmask   =   pfm_linespacing
tcf2.cbsize   =   lenb(tcf2)
lr   =   sendmessagelong(hwnd,   em_getparaformat,   0,   varptr(tcf2))
elinespacingstyle   =   tcf2.blinespacingrule
yspacing   =   tcf2.dylinespacing

end   sub

public   sub   setparagraphlinespacing(   byval   hwnd   as   long,byval   elinespacingstyle   as   erecparagraphlinespacingconstants,   byval   yspacing   as   long)

dim   tcf2   as   paraformat2
dim   lr   as   long

tcf2.dwmask   =   pfm_linespacing
tcf2.cbsize   =   lenb(tcf2)
tcf2.blinespacingrule   =   elinespacingstyle
tcf2.dylinespacing   =   yspacing
lr   =   sendmessagelong(hwnd,   em_setparaformat,   0,   varptr(tcf2))

end   sub

public   sub   getparagraphspacing(byval   hwnd   as   long,byref   lspaceafter   as   long,   byref   lspacebefore   as   long)

dim   tcf2   as   paraformat2
dim   lr   as   long

                tcf2.dwmask   =   pfm_spacebefore   or   pfm_spaceafter
                tcf2.cbsize   =   lenb(tcf2)
                lr   =   sendmessagelong(hwnd,   em_getparaformat,   0,   varptr(tcf2))
                lspaceafter   =   tcf2.dyspaceafter
                lspacebefore   =   tcf2.dyspacebefore
   
end   sub

public   sub   setparagraphspacing(byval   hwnd   as   long,byval   lspaceafter   as   long,   byval   lspacebefore   as   long)

dim   tcf2   as   paraformat2
dim   lr   as   long

                tcf2.dwmask   =   pfm_spacebefore   or   pfm_spaceafter
                tcf2.cbsize   =   lenb(tcf2)
                tcf2.dyspaceafter   =   lspaceafter
                tcf2.dyspacebefore   =   lspacebefore
                lr   =   sendmessagelong(hwnd,   em_setparaformat,   0,   varptr(tcf2))
   
end   sub
发表于:2007-06-15 16:55:188楼 得分:0
please   give   feedback   to   vbadvisor
发表于:2007-06-15 16:57:539楼 得分:0
另外只有10分?太那个了。
just   kidding.
发表于:2007-06-15 17:07:0710楼 得分:0
我實在是沒分了,有我可以大把地給,我這裏怎麽還是有錯?提示:在過程外無效
发表于:2007-06-15 18:53:2711楼 得分:0
你是怎样用的?
发表于:2007-06-15 19:19:2512楼 得分:0
你试试改变setparagraphlinespacing的第二,第三参数。
你试试改变setparagraphspacing的第二,第三参数。
private   sub   form_load()
      dim   lafteradjust   as   long,   lbeforeadjust   as   long
      lafteradjust   =   10
      lbeforeadjust   =   500
        'call   crt.setparagraphspacing(rtb.hwnd,   lafteradjust   ,   lbeforeadjust   )
        call   crt.setparagraphlinespacing(rtb.hwnd,   erclinespacingtwips,   lbeforeadjust   )
       
        rtb.text   =   "after   considerable   delay,   the   party   proceeded   to   some   ponds   in   the   bogan   about   five   miles   lower   down.   we   were   now   nearly   opposite   to   the   scene   of   mr.   cunningham 's   disasters:   "
        rtb.text   =   rtb.text   &   "i   had   recognised,   amongst   the   first   hills   i   saw   when   on   the   goobang   creek,   the   hill   which   i   had   named   mount   juson,   at   his   request,   after   the   maiden   name   of   his   mother.   the   little   pyramid   of   bushes   was   no   longer   there,   but   the   name   of   cunningham   was   so   identified   with   the   botanical   history   of   almost   all   the   shrubs   in   the   very   peculiar   scenery   of   that   part   of   the   country,   that   no   other   monument   seemed   necessary.   other   recollections   recalled   cunningham   to   my   mind;   his   barbarous   murder,   and   the   uncertainty   which   still   hung   over   the   actual   circumstances   attending   it.   the   shrubs   told   indeed   of   cunningham;   of   both   brothers,   both   now   dead;   but   neither   the   shrubs   named   by   the   one,   nor   the   gloomy   <i/> casuarin&#230; </i>   trees   that   had   witnessed   the   bloody   deed,   could   tell   more.   there   the   <i/> acacia   pendula </i> ,   first   discovered   and   described   by   allan,   could   only "

end   sub
发表于:2007-06-15 19:23:0013楼 得分:10
注:把上面的code放到1个class:clsrichtextjustify中。
option   explicit
dim   crt   as   clsrichtextjustify

private   sub   form_load()
dim   lafteradjust   as   long,   lbeforeadjust   as   long
lafteradjust   =   10
lbeforeadjust   =   500

set   crt   =   new   clsrichtextjustify

'你试试改变setparagraphlinespacing的第二,第三参数。
'你试试改变setparagraphspacing的第二,第三参数。
'call   crt.setparagraphspacing(rtb.hwnd,   lafteradjust   ,   lbeforeadjust   )
call   crt.setparagraphlinespacing(rtb.hwnd,   erclinespacingtwips,   lbeforeadjust   )

rtb.text   =   "after   considerable   delay,   the   party   proceeded   to   some   ponds   in   the   bogan   about   five   miles   lower   down.   we   were   now   nearly   opposite   to   the   scene   of   mr.   cunningham 's   disasters:   "
rtb.text   =   rtb.text   &   "i   had   recognised,   amongst   the   first   hills   i   saw   when   on   the   goobang   creek,   the   hill   which   i   had   named   mount   juson,   at   his   request,   after   the   maiden   name   of   his   mother.   the   little   pyramid   of   bushes   was   no   longer   there,   but   the   name   of   cunningham   was   so   identified   with   the   botanical   history   of   almost   all   the   shrubs   in   the   very   peculiar   scenery   of   that   part   of   the   country,   that   no   other   monument   seemed   necessary.   other   recollections   recalled   cunningham   to   my   mind;   his   barbarous   murder,   and   the   uncertainty   which   still   hung   over   the   actual   circumstances   attending   it.   the   shrubs   told   indeed   of   cunningham;   of   both   brothers,   both   now   dead;   but   neither   the   shrubs   named   by   the   one,   nor   the   gloomy   <i/> casuarin&#230; </i>   trees   that   had   witnessed   the   bloody   deed,   could   tell   more.   there   the   <i/> acacia   pendula </i> ,   first   discovered   and   described   by   allan,   could   only "

end   sub


快速检索

最新资讯
热门点击