RM Report text box Wrap related code

Source: Internet
Author: User

procedureTrmcustommemoview.wrapmemo1 (Aaddchar:boolean);varlcurheight, Lonelineheight, Lmaxwidth:integer;  Lwcanvas:tcanvas; procedure_outline (Constlstr:widestring); beginFsmemo.add (LSTR);  INC (Lcurheight, lonelineheight); End; procedure_wrapoutmemo; varh, Oldh:hfont;  I:integer; beginh:= Rmcreateapifont (Lwcanvas.font,0, Ffontscalewidth); OLDH:=SelectObject (Lwcanvas.handle, h); TryLcurheight:=0; Lonelineheight:=-lwcanvas.font.height + linespacing;//The height of each line;Lmaxwidth: = Spwidth-spgapleft *2-_calchframewidth (Leftframe.spwidth, rightframe.spwidth); if(Docmode = rmdmdesigning) and(FParentReport.FDesigner.Factor <> -) ThenLmaxwidth:= Round (Lmaxwidth * -/FParentReport.FDesigner.Factor); if(Docmode = rmdmdesigning) and(Fmemo1.count =1) and(Rmwidecanvastextwidth (Lwcanvas, fmemo1[0]) > Lmaxwidth) and(fmemo1[0] <>"') and(fmemo1[0][1] ='[') Then_outline (fmemo1[0])      Else      begin        if  notfneedwrapped Then //No line breaks required        begin           forI: =0  toFmemo1.count-1  Do_outline (Fmemo1[i]); End        Else ifWordWraporAllowhtmltag Then //Wrap Line        beginLcurheight:= Lcurheight + rmwrapstrings (FMemo1, Fsmemo, Lwcanvas, Lmaxwidth, linespacing{Lonelineheight}, Wordbreak, Charwrap, Allowhtmltag, True, Aaddchar); Fsmemo.add (#1); End        Else //do not wrap lines        begin           forI: =0  toFmemo1.count-1  Do          begin_outline (Fmemo1[i]); End; Fsmemo.add (#1); End; End; finallyFvheight:= Lcurheight-linespacing; Lineheight:=Lonelineheight;      SelectObject (Lwcanvas.handle, OLDH);    DeleteObject (h); End; End; procedure_wrapoutmemo90; varh, Oldh:hfont;  I:integer; beginh:= Rmcreateapifont (Lwcanvas.font, -, Ffontscalewidth); OLDH:=SelectObject (Lwcanvas.handle, h); TryLcurheight:=0; Lonelineheight:=-lwcanvas.font.height +linespacing; Lmaxwidth:= Spheight-spgaptop *2-_calcvframewidth (Topframe.spwidth, bottomframe.spwidth); if  notfneedwrapped Then      begin         forI: =0  toFmemo1.count-1  Do_outline (Fmemo1[i]); End      Else ifWordWrap ThenLcurheight:= Lcurheight + rmwrapstrings (FMemo1, Fsmemo, Lwcanvas, Lmaxwidth, linespacing{Lonelineheight}, Wordbreak, Charwrap, Allowhtmltag, True, Aaddchar)Else      begin         forI: =0  toFmemo1.count-1  Do_outline (Fmemo1[i]); End; finallyFvheight:= Lcurheight-linespacing; Lineheight:=Lonelineheight;      SelectObject (Lwcanvas.handle, OLDH);    DeleteObject (h); End; End; procedure_wrapoutmemo180; varI:integer; beginLcurheight:=0; Lonelineheight:=-lwcanvas.font.height + linespacing;//The height of each line;Lmaxwidth: = Spheight-spgaptop *2-_calcvframewidth (Topframe.spwidth, bottomframe.spwidth); if(Docmode = rmdmdesigning) and(Fmemo1.count =1) and(Rmwidecanvastextwidth (Lwcanvas, fmemo1[0]) > Lmaxwidth) and(fmemo1[0] <>"') and(fmemo1[0][1] ='[') Then_outline (fmemo1[0])    Else    begin      if  notfneedwrapped Then //line has been wrapped      begin         forI: =0  toFmemo1.count-1  Do_outline (Fmemo1[i]); End      Else ifWordWrap Then //Wrap Line      beginLcurheight:= Lcurheight + rmwrapstrings (FMemo1, Fsmemo, Lwcanvas, Lmaxwidth, linespacing{Lonelineheight}, Wordbreak, Charwrap, Allowhtmltag, False, Aaddchar); End      Else //do not wrap lines      begin         forI: =0  toFmemo1.count-1  Do        begin_outline (Fmemo1[i]); End; End; End; Fvheight:= Lcurheight-linespacing; Lineheight:=Lonelineheight; End; procedure_changefontsize; varI:integer; LSTR:string;  Lmaxwidth:integer; beginLmaxwidth:= Spwidth-spgapleft *2-_calchframewidth (Leftframe.spwidth, rightframe.spwidth); ifLmaxwidth <Ten  ThenExit;  forI: =0  toFmemo1.count-1  Do    beginLstr:=Fmemo1[i];  while(Rmwidecanvastextwidth (Lwcanvas, lstr) > Lmaxwidth) and(LWCanvas.Font.Size >0) DolWCanvas.Font.Size:= LWCanvas.Font.Size-1; End; Font.Size:=lWCanvas.Font.Size; End;begin  if  notAutoaddblank ThenAaddchar:=False; ifRotationType <> Rmrtnone ThenAllowhtmltag:=False;  FParentReport.DrawCanvas.LockCanvas; TryLwcanvas:=FParentReport.DrawCanvas.Canvas;    LWCanvas.Font.Assign (Font); LWCanvas.Font.Height:=-round (Font.Size * the/ the);    SetTextCharacterExtra (Lwcanvas.handle, characterspacing);  CaseFscalefonttype ofRmstbywidth:begin          ifDocmode <> rmdmdesigning Then_changefontsize; End; Rmstbyheight:begin        End; End;    Fsmemo.clear;  CaseRotationType ofrmrt90, rmrt270: _wrapoutmemo90;    rmrt180: _wrapoutmemo180; Else_wrapoutmemo; End; SetTextCharacterExtra (Lwcanvas.handle,0); finallyfneedwrapped:=False;  FParentReport.DrawCanvas.UnLockCanvas; End;End;

RM Report text box Wrap related code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.