问题
Is it possible to highlight a specific line in active editor window just like Delphi IDE does when highlighting compiler errors?
回答1:
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;
来源:https://stackoverflow.com/questions/22498243/how-to-highlight-a-specific-line-in-source-editor-using-opentoolsapi