📄 setparamfrm.pas
字号:
unit SetParamFrm;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Buttons, StdCtrls, ExtCtrls, GlobePas;
type
TfrmSetComm = class(TForm)
Panel1: TPanel;
Label1: TLabel;
Label2: TLabel;
CMPort: TComboBox;
EdPhone: TEdit;
SBOK: TSpeedButton;
SBExit: TSpeedButton;
procedure SBOKClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure SBExitClick(Sender: TObject);
private
{ Private declarations }
ClickOK: Boolean;
public
{ Public declarations }
end;
function Show_SetComm: Boolean;
var
frmSetComm: TfrmSetComm;
implementation
{$R *.DFM}
function Show_SetComm: Boolean;
begin
with TfrmSetComm.Create(nil) do
begin
ClickOK := False;
try
ShowModal;
finally
Result := ClickOK;
Free;
end;
end;
end;
procedure TfrmSetComm.SBOKClick(Sender: TObject);
begin
if (CMPort.ItemIndex = -1) or (EdPhone.Text = '') then
begin
Application.MessageBox('请把通信参数填写完整!', '系统提示', MB_OK + MB_ICONWARNING);
Exit;
end;
with CommPort do
begin
Port := CMPort.Items.Strings[CMPort.ItemIndex];
Phone := EdPhone.Text;
Rate := '9600';
SaveParam;
ClickOK := True;
Self.Close;
end;
end;
procedure TfrmSetComm.FormCreate(Sender: TObject);
begin
LoadParam;
if CommPort.Port <> '' then
CMPort.ItemIndex := CMPort.Items.IndexOf(CommPort.Port)
else
CMPort.ItemIndex := 0;
EdPhone.Text := CommPort.Phone;
end;
procedure TfrmSetComm.SBExitClick(Sender: TObject);
begin
Close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -