如何使用OpenToolsAPI在源代码编辑器中突出显示特定行 [英] How to highlight a specific line in source editor using OpenToolsAPI

查看:115
本文介绍了如何使用OpenToolsAPI在源代码编辑器中突出显示特定行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以像突出显示编译器错误时一样,在Delphi IDE中突出显示活动编辑器窗口中的特定行?

Is it possible to highlight a specific line in active editor window just like Delphi IDE does when highlighting compiler errors?

推荐答案

如果可以在最上方的编辑器中转到某一行,则可以尝试以下操作:

If it's OK to just go to a certain line in the topmost editor then try this:

procedure GotoLine(LineNumber: Integer);
var
  EditorServices: IOTAEditorServices;
  Buffer: IOTAEditBuffer;
  Position: IOTAEditPosition;
begin
  if not Supports(BorlandIDEServices, IOTAEditorServices, EditorServices) then
    Exit;
  Buffer := EditorServices.TopBuffer;
  if not Assigned(Buffer) then
    Exit;
  Position := Buffer.EditPosition;
  if not Assigned(Position) then
    Exit;
  Position.GotoLine(LineNumber);
  Buffer.TopView.Paint;
end;

这篇关于如何使用OpenToolsAPI在源代码编辑器中突出显示特定行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆