1

是否可以在 a 中的单词的屏幕中获取 XY 坐标TRichViewEdit

如果是这样,怎么办?

4

1 回答 1

6

You can use the GetItemCoords method to get the position of an item in the formatted document:

procedure TForm1.Button1Click(Sender: TObject);
var
  X, Y: Integer;
begin
  RichViewEdit1.Add('Hello ', 0);
  RichViewEdit1.Add('world!', 0);
  RichViewEdit1.Format;

  RichViewEdit1.GetItemCoords(2, X, Y);
  ShowMessage('Position of the second word: [' + IntToStr(X) + '; ' +
    IntToStr(Y) + ']');
end;
于 2013-02-12T17:00:16.910 回答