问题描述
我在网上搜了vb这个方面的程序,如下,但是,我现在只能把行间距,缩小为原来的一半,也就是上面的那部分的间距去掉了,下面的还在。bLineSpacingRule,dyLineSpacing这两个参数设置成什么,才能去掉全部的行间距啊。我现在是各种大小的字体的行间距全都不要。随着vb6几个补丁的退出,事实上richtextbox正悄悄发生变化,它已经支持richedit2.0了,所以我们可以设置结构体PARAFORMAT2的dyLineSpacing成员,然后将PARAFORMAT2结构体作为lparam参数,对richtextbox发送EM_SETPARAFORMAT消息,即可实现我们的要求,具体代码如下:OptionExplicitPrivateDeclareFunctionSendMessage&Lib"user32"Alias"SendMessageA"_(ByValhwndAsLong,ByValwMsgAsLong,_ByValwParamAsLong,lParamAsAny)PrivateConstWM_USER&=&H400PrivateConstEM_GETPARAFORMAT=(WM_USER+61)PrivateConstEM_SETPARAFORMAT=(WM_USER+71)PrivateConstMAX_TAB_STOPS=32&PrivateTypePARAFORMAT2'LosprimeroscamposcoincidenconPARAFORMATyseusanigualcbSizeAsIntegerwPad1AsIntegerdwMaskAsLongwNumberingAsIntegerwEffectsAsInteger'NousadoenPARAFORMATdxStartIndentAsLongdxRightIndentAsLongdxOffsetAsLongwAlignmentAsIntegercTabCountAsIntegerlTabStops(0ToMAX_TAB_STOPS-1)AsLong'Desdeaquíloa?adidoporPARAFORMAT2dySpaceBeforeAsLong'/*Verticalspacingbeforepara*/dySpaceAfterAsLong'/*Verticalspacingafterpara*/dyLineSpacingAsLong'/*LinespacingdependingonRule*/sStyleAsInteger'/*Stylehandle*/bLineSpacingRuleAsByte'/*Ruleforlinespacing(seetom.doc)*/bOutlineLevelAsByte'/*OutlineLevel*/'antesbCRCAsBytewShadingWeightAsInteger'/*Shadinginhundredthsofapercent*/wShadingStyleAsInteger'/*Byte0:style,nib2:cfpat,3:cbpat*/wNumberingStartAsInteger'/*Startingvaluefornumbering*/wNumberingStyleAsInteger'/*Alignment,Roman/Arabic,(),),.,etc.*/wNumberingTabAsInteger'/*Spacebet1stindentand1st-linetext*/wBorderSpaceAsInteger'/*Border-textspaces(nbl/bdrinpts)*/wBorderWidthAsInteger'/*Penwidths(nbl/bdrinhalftwips)*/wBordersAsInteger'/*Borderstyles(nibble/border)*/EndType'/*PARAFORMATmaskvalues*/PrivateConstPFM_STARTINDENT=&H1&PrivateConstPFM_RIGHTINDENT=&H2&PrivateConstPFM_OFFSET=&H4&PrivateConstPFM_ALIGNMENT=&H8&PrivateConstPFM_TABSTOPS=&H10&PrivateConstPFM_NUMBERING=&H20&PrivateConstPFM_OFFSETINDENT=&H80000000'/*PARAFORMATnumberingoptions*/PrivateConstPFN_BULLET=&H1&'/*PARAFORMATalignmentoptions*/PrivateConstPFA_LEFT=&H1&PrivateConstPFA_RIGHT=&H2&PrivateConstPFA_CENTER=&H3&'/*PARAFORMAT2.0masks*/PrivateConstPFM_SPACEBEFORE=&H40&PrivateConstPFM_SPACEAFTER=&H80&PrivateConstPFM_LINESPACING=&H100&PrivateConstPFM_STYLE=&H400&PrivateConstPFM_NUMBERINGSTYLE=&H2000&'/*RE3.0*/PrivateConstPFM_NUMBERINGTAB=&H4000&'/*RE3.0*/PrivateConstPFM_NUMBERINGSTART=&H8000&'/*RE3.0*/PrivateConstPFM_TABLE=&HC0000000'/*RE3.0*/'//ThefollowingthreepropertiesarereadonlyPrivateConstPFM_COLLAPSED=&H1000000'/*RE3.0*/PrivateConstPFM_OUTLINELEVEL=&H2000000'/*RE3.0*/PrivateConstPFM_BOX=&H4000000'/*RE3.0*/'/*PARAFORMAT2wNumberingoptions(seealsoPFN_BULLET)*/PrivateConstPFN_ARABIC=2'/*tomListNumberAsArabic:0,1,2,...*/PrivateConstPFN_LCLETTER=3'/*tomListNumberAsLCLetter:a,b,c,...*/PrivateConstPFN_UCLETTER=4'/*tomListNumberAsUCLetter:A,B,C,...*/PrivateConstPFN_LCROMAN=5'/*tomListNumberAsLCRoman:i,ii,iii,...*/PrivateConstPFN_UCROMAN=6'/*tomListNumberAsUCRoman:I,II,III,...*/'/*PARAFORMAT2wNumberingStyleoptions*/PrivateConstPFNS_PAREN=&H0'/*default,e.g.,1)*/PrivateConstPFNS_PARENS=&H100'/*tomListParentheses/256,e.g.,(1)*/PrivateConstPFNS_PERIOD=&H200'/*tomListPeriod/256,e.g.,1.*/PrivateConstPFNS_PLAIN=&H300'/*tomListPlain/256,e.g.,1*/PrivateConstPFNS_NONUMBER=&H400'/*Usedforcontinuationw/onumberPrivateSubForm_Load()DimpfAsPARAFORMAT2Withpf.cbSize=LenB(pf)pf.dwMask=PFM_LINESPACING.bLineSpacingRule=4.dyLineSpacing=me.richtextbox1.font.size*22EndWithDimiAsLongi=SendMessage(RichTextBox1.hwnd,EM_SETPARAFORMAT,0,ByValVarPtr(pf))EndSub
解决方案
解决方案二:
help