必须的
,配置了几个热键之后,还是非常方便的 。 推荐键盘党使用
//热键 ctrl+D
program DeleteLinesPlus;
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Clipbrd;
var
Lines: TStringList;
col,row:integer;
begin
Lines := TStringList.Create;
//取当前行列坐标
IdeEditorGetEditPos(col,row);
try
if IdeGetEditorSelectedLines(Lines) then
begin
// 将选中的行保存如剪贴板
Clipboard.Clear;
Clipboard.AsText := Lines.Text;
//清除原有的内容
Lines.Clear;
IdeSetEditorSelectedLines(Lines);
//光标上移一行
IdeEditorGotoEditPos(col,row-1,true);
IdeGetEditorSelectedLines(Lines);
Lines.Text := Clipboard.AsText + Lines.Text;
IdeSetEditorSelectedLines(lines);
IdeEditorGotoEditPos(col,row-1,true);
end;
finally
Lines.Free;
Clipboard.Free;
end;
end.
//热键 ctrl+L
program DuplicateLine;
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Clipbrd;
var
Lines: TStringList;
Clipboard: TClipboard;
i: Integer;
begin
Lines := TStringList.Create;
Clipboard := TClipboard.Create;
try
if IdeGetEditorSelectedLines(Lines) then
begin
Clipboard.Clear;
Clipboard.AsText := Lines.Text;
end;
if Clipboard.HasFormat(1) then
begin
// if IdeGetEditorSelectedLines(Lines) then
// begin
// IdeSetEditorSelectedLines(Lines);
// end;
if IdeGetEditorSelectedLines(Lines) then
begin
Lines.Text := Clipboard.AsText + Lines.Text;
IdeSetEditorSelectedLines(Lines);
end;
end;
finally
Lines.Free;
Clipboard.Free;
end;
end.
//热键 ctrl+Down
program MoveDn;
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Clipbrd;
var
Lines: TStringList;
col,row:integer;
begin
Lines := TStringList.Create;
//取当前行列坐标
IdeEditorGetEditPos(col,row);
try
if IdeGetEditorSelectedLines(Lines) then
begin
// 将选中的行保存如剪贴板
Clipboard.Clear;
Clipboard.AsText := Lines.Text;
//清除原有的内容
Lines.Clear;
IdeSetEditorSelectedLines(Lines);
//光标上移一行
IdeEditorGotoEditPos(col,row+1,true);
IdeGetEditorSelectedLines(Lines);
Lines.Text := Clipboard.AsText + Lines.Text;
IdeSetEditorSelectedLines(lines);
IdeEditorGotoEditPos(col,row+1,true);
end;
finally
Lines.Free;
Clipboard.Free;
end;
end.
//热键 ctrl+up
program MoveUP;
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Clipbrd;
var
Lines: TStringList;
col,row:integer;
begin
Lines := TStringList.Create;
//取当前行列坐标
IdeEditorGetEditPos(col,row);
try
if IdeGetEditorSelectedLines(Lines) then
begin
// 将选中的行保存如剪贴板
Clipboard.Clear;
Clipboard.AsText := Lines.Text;
//清除原有的内容
Lines.Clear;
IdeSetEditorSelectedLines(Lines);
//光标上移一行
IdeEditorGotoEditPos(col,row-1,true);
IdeGetEditorSelectedLines(Lines);
Lines.Text := Clipboard.AsText + Lines.Text;
IdeSetEditorSelectedLines(lines);
IdeEditorGotoEditPos(col,row-1,true);
end;
finally
Lines.Free;
Clipboard.Free;
end;
end.