我想在排水沟左侧单击时选择一条线,类似于Delphi代码编辑器(点击行号,安装CNPack)。我想答案在于selStart,selEnd,smLine选择模式,但无法做出任何可行的解决方案。
procedure TForm1.SynEdit1GutterClick(Sender: TObject; Button: TMouseButton; X,
Y, Line: Integer; Mark: TSynEditMark);
begin
SynEdit1.SelectionMode := smLine;
SynEdit1.SelStart := 0;
SynEdit1.SelEnd := SynEdit1.Lines[Line].Length;
SynEdit1.SelectionMode := smNormal; //restore
//Code not working
//I don't remember the code which made it select a line with smLine
end;
答案 0 :(得分:2)
您可以使用ecSelLineEnd
命令:
SynEdit1.ExecuteCommand(ecSelLineEnd, #0, nil)
在天沟点击事件中。
您需要包含单位SynEditKeyCmds