?? editlyric.pas
字號:
unit EditLyric;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls,ComVariable;
type
TForm5 = class(TForm)
Panel1: TPanel;
ListBox1: TListBox;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
Button6: TButton;
ListEdit: TEdit;
Button7: TButton;
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ListEditKeyPress(Sender: TObject; var Key: Char);
procedure ListBox1DblClick(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure ListBox1Exit(Sender: TObject);
procedure Button7KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Button7Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form5: TForm5;
implementation
{$R *.dfm}
procedure TForm5.Button1Click(Sender: TObject);
begin
SaveDialog1.InitialDir:=Path+'LRC\';
SaveDialog1.FileName:='未命名.LRC';
if SaveDialog1.Execute then
begin
listbox1.Items.SaveToFile(SaveDialog1.FileName);
end;
end;
procedure TForm5.Button2Click(Sender: TObject);
var
Temp:integer;
M,S:Double;
str:String;
begin
if ListBox1.ItemIndex=-1 then Exit;
Temp:=trunc(NowTime*100);
M:=Temp div 6000;
if M>9 then str:='['+floattostr(M)+':'
else str:='[0'+floattostr(M)+':';
S:=Temp Mod 6000;
S:=S/100.0;
s:=strtofloat(FormatFloat('#0.00',S));
if S>=10.0 then str:=str+floattostr(S)+']'
else str:=str+'0'+floattostr(S)+']';
ListBox1.Items[ListBox1.ItemIndex]:=str+ListBox1.Items[ListBox1.ItemIndex];
end;
procedure TForm5.Button3Click(Sender: TObject);
begin
OpenDialog1.InitialDir:=Path+'LRC\';
if OpenDialog1.Execute then
begin
ListBox1.Items.Clear;
ListBox1.Items.LoadFromFile(OpenDialog1.FileName);
end;
end;
procedure TForm5.Button4Click(Sender: TObject);
begin
if ListBox1.ItemIndex=-1 then Exit;
ListBox1.Items.Delete(ListBox1.ItemIndex);
end;
procedure TForm5.Button5Click(Sender: TObject);
begin
if ListBox1.ItemIndex=-1 then Exit;
ListBox1.Items.Insert(ListBox1.ItemIndex,'');
end;
procedure TForm5.Button6Click(Sender: TObject);
begin
ListBox1.Items.Clear;
end;
procedure TForm5.Button7Click(Sender: TObject);
begin
ListBox1.Items.Append('');
end;
procedure TForm5.Button7KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
ListBox1.Items.Add('');
end;
procedure TForm5.FormCreate(Sender: TObject);
begin
ListEdit.Visible := false;
ListEdit.Ctl3D := false;
ListEdit.BorderStyle := bsNone;
ListEdit.Parent := ListBox1;
ListEdit.Width := ListBox1.ClientWidth;
ListEdit.OnKeyPress := ListEditKeyPress;
end;
procedure TForm5.ListBox1DblClick(Sender: TObject);
var
ii : integer;
lRect: TRect;
begin
ii := ListBox1.ItemIndex;
if ii = -1 then exit;
lRect := ListBox1.ItemRect(ii) ;
ListEdit.Top := lRect.Top + 1;
ListEdit.Left := lRect.Left + 1;
ListEdit.Width:=(lRect.Right-lRect.Left)+1;
ListEdit.Height := (lRect.Bottom - lRect.Top) + 1;
ListEdit.Text := ListBox1.Items.Strings[ii];
ListBox1.ItemIndex:=ii;
ListEdit.Visible := True;
ListEdit.SelectAll;
ListEdit.SetFocus;
end;
procedure TForm5.ListBox1Exit(Sender: TObject);
begin
ListEdit.Visible := false;
end;
procedure TForm5.ListEditKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
ListBox1.Items[ListBox1.ItemIndex]:=ListEdit.Text;
ListEdit.Visible := False;
Key := #0;
end;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -