📄 connectdlg.pas
字号:
unit ConnectDlg;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, Registry;
type
TClientConnectForm = class(TForm)
Label1: TLabel;
Label2: TLabel;
PortEdit: TEdit;
ConnectBut: TBitBtn;
CancelBut: TBitBtn;
ServerCombo: TComboBox;
Label3: TLabel;
PassEdit: TEdit;
StartScreenBox: TCheckBox;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
procedure LoadCombo;
procedure SaveCombo;
public
{ Public declarations }
end;
var
ClientConnectForm: TClientConnectForm;
implementation
{$R *.DFM}
procedure TClientConnectForm.FormClose(Sender: TObject;
var Action: TCloseAction);
var
s: string;
i: integer;
begin
s := ServerCombo.Text;
i := ServerCombo.Items.IndexOf(s);
if i <> -1 then ServerCombo.Items.Delete(i);
ServerCombo.Items.Insert(0, s);
while ServerCombo.Items.Count > 8 do
ServerCombo.Items.Delete(8);
ServerCombo.Text := s;
SaveCombo;
end;
procedure TClientConnectForm.FormShow(Sender: TObject);
begin
LoadCombo;
ServerCombo.SetFocus;
end;
procedure TClientConnectForm.LoadCombo;
var
ini: TRegIniFile;
begin
ini := TRegIniFile.Create('Software\' + Application.Title);
ServerCombo.Items.CommaText := ini.ReadString('Servers', 'ServerCombo', '');
ServerCombo.ItemIndex := 0;
ini.Free;
end;
procedure TClientConnectForm.SaveCombo;
var
ini: TRegIniFile;
begin
ini := TRegIniFile.Create('Software\' + Application.Title);
ini.WriteString('Servers', 'ServerCombo', ServerCombo.Items.CommaText);
ini.Free;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -