Automatically allowing Ctrl+A to select all in a TMemo?

后端 未结 2 710
谎友^
谎友^ 2021-02-07 23:43

In Delphi 7\'s TMemo control, an attempt to do the key combo Ctrl + A to select all does not do anything (doesn\'t select all). So I\'ve made this procedure:

<
2条回答
  •  忘了有多久
    2021-02-07 23:55

    This is more elegant:

    procedure TForm1.Memo1KeyPress(Sender: TObject; var Key: Char);
    begin
      if Key = ^A then
      begin
        (Sender as TMemo).SelectAll;
        Key := #0;
      end;
    end;
    

提交回复
热议问题