1

I'm using Delphi XE today (one of four versions I play with :)

I've installed SynEdit/SynMemo to replace the standard TMemo.

(a) I want to highlight a whole line based on its line number. (b) When I click on the first line, I want the caret to go to the start of the line not appear where I click - more like notepad than a code editor.

Any help much appreciated!

Oli Howson
  • 43
  • 6

1 Answers1

2

To highlight a specific line you need to use OnSpecialLineColors event.

Try this code:

procedure TfrmMain.SynMemo1SQLSpecialLineColors(Sender: TObject; Line: Integer;
  var Special: Boolean; var FG, BG: TColor);
begin
  // Change highlight for the first line.
  if Line = 1 then
  begin
    BG := clBlack;
    FG := clGreen;
  end;
end;

Also, make sure that Highlighter property is not set, otherwise it might override your highlighting.

Wodzu
  • 6,932
  • 10
  • 65
  • 105