delphi memo 通过行号 定位 指定行
procedure TForm1.Button1Click(Sender: TObject); var LineNumber, StartPos, LineLength: Integer; begin LineNumber := 2; // The line number to select (0-based) // Calculate the start position of the line StartPos := Memo1.Perform(EM_LINEINDEX, LineNumber, 0); // Calculate the length of the line LineLength := Memo1.Perform(EM_LINELENGTH, StartPos, 0); // Select the line Memo1.SelStart := StartPos; Memo1.SelLength := LineLength; // Set focus to the memo to show the selected line Memo1.SetFocus; end;
Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号
执行时间: 0.045003890991211 seconds