专注于互联网--专注于架构

最新标签
网站地图
文章索引
Rss订阅
首先在form上放置一个richedit。在窗体的构造函数中添加以下代码:__fastcall tmainform::tmainform(tcomponent* owner): tform(owner){unsigned mask = sendmessage(richedit1->handle, em_geteventmask, 0, 0);sendmessage(richedit1->handle, em_seteventmask, 0, mask | enm_link);sendmessage(richedit1->handle, e [阅读全文] [PDF]
一、如何得知当前行号  用RichEdit(或者memo)控件制作文本编辑器时,通过访问lines??count属性可以得到总行数,但是若想知道光标当前所在行的行号就麻烦了,因为delphi没有提供这个属性。要实现这个编辑器必备功能,就须调用em_ LineFromChar。请试试下面的程序。  先在窗口中布置一个RichEdit或者memo(命名为editor),以及一个button。在button的onclick事件中写入下列代码。  var  CurrentLine:Integer;  begin  CurrentLine:= [阅读全文] [PDF]
// 指定输入游标的位置procedure SetCaret(RTF: TRichEdit; var Row, Col: word);vari, iStopLine, iSelStart: integer;beginif (RTF = nil) then Exit;if Row = 0 then Row := 1;if Col = 0 then Col := 1;// 到第 Row 列, Col 行共几个字元iStopLine := Row - 1;iSelStart := 0;for i := 0 to RTF.Lines.Count - 1 dobeg [阅读全文] [PDF]
// You can move the caret in a TRichEdit component by using this code :procedure RichEdit_MoveTo(RichEdit: TRichEdit; LineNumber, CharNumber: Word);begin RichEdit.SelStart := RichEdit.Perform(EM_LINEINDEX, LineNumber, 0) + CharNumber);end;procedure TForm1.Button1Click(Sender: TObj [阅读全文] [PDF]
使用时与一般的WinAPI相差不多, 以下有一个包装过的函式.(* MsgBox(提示文字, 标题, ID_Flat) 讯息视窗(* ============================================(* 第叁个引数的设定与本函数传回值, 请参阅 WinAPI 中对(* MessageBox 的说明(*(* Delphi 1.0(* ----------(* 本函数传入值为 Object Pascal 式的字串, 如果需(* 要传入 PChar 请直接呼叫 Application.MessageBox(*(* Delphi 2.0(* [阅读全文] [PDF]
unitUnit1; interface uses Windows,Messages,SysUtils,Variants,Classes,Graphics,Controls,Forms, Dialogs,StdCtrls,ComCtrls,RichEdit,Shellapi; type TForm1=class(TForm) RichEdit1:TRichEdit; Button1:TButton; procedureFormCreate(Sender:TObject); private {Privatedeclarations} public {Publ [阅读全文] [PDF]
1 共6条 分1页