鸿 网 互 联 www.68idc.cn

Delphi 为RichEdit设置行号

来源:互联网 作者:佚名 时间:2021-12-14 17:55
procedure TForm1.Button4Click(Sender: TObject);const PFNS_PAREN = $000; //e.g. 1) PFNS_PARENS = $100; //e.g. (1) PFNS_PERIOD = $200; //e.g. 1. PFNS_PLAIN = $300; PFNS_NONUMBER = $400;const PFN_NONE = $00000000; //无 PFN_BULLET = $00000001;
procedure TForm1.Button4Click(Sender: TObject);const  PFNS_PAREN=$000;  //e.g. 1)  PFNS_PARENS= $100;  //e.g. (1)  PFNS_PERIOD= $200;  //e.g. 1.  PFNS_PLAIN=$300;  PFNS_NONUMBER =$400;const  PFN_NONE     = $00000000;  //无  PFN_BULLET   = $00000001;  //黑色实心圆点  PFN_ARABIC   = $00000002;  //0,1,2  PFN_LCLETTER = $00000003;  //a,b,c  PFN_UCLETTER = $00000004;  //A,B,C  PFN_LCROMAN  = $00000005;  //i,ii,iii  PFN_UCROMAN  = $00000006;  //I,II,III  var  pf: PARAFORMAT2;begin  FillChar(pf, sizeof(paraformat2), #0);  pf.cbSize := SizeOf(paraformat2);  //PFM_NUMBERING: wNumbering 值有效  //PFM_NUMBERINGSTYLE: wNumberingStyle值有效  //PFM_NUMBERINGSTART: wNumberingStart值有效  //PFM_STARTINDENT: dxStartIndent值有效  pf.dwMask := PFM_NUMBERING or PFM_NUMBERINGSTYLE or PFM_NUMBERINGSTART or PFM_STARTINDENT;//or PFM_OFFSET;  pf.wNumberingStyle := PFNS_PERIOD;  //设置行号的样式,可以为“)”,“.”,“()”  pf.wNumberingStart := 1;            //设置行号起始值  pf.wNumbering := PFN_ARABIC;        //设置行号的格式,可以为阿拉伯数字或者英文字母等格式  pf.dxStartIndent := 60;             //设置行首缩进值  RichEdit1.SelectAll;  SendMessage(RichEdit1.Handle, EM_SETPARAFORMAT, 0, LPARAM(@pf));  RichEdit1.SelStart := 0;  RichEdit1.SelLength := 0;end;
网友评论
<