📄 comselect.pas
字号:
unit ComSelect;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls,INIFIles;
type
TfmSelectComPort = class(TForm)
grpComSelect: TGroupBox;
cmboComport: TComboBox;
btnOK: TButton;
procedure btnOKClick(Sender: TObject);
Procedure Change;
private
{ Private declarations }
public
{ Public declarations }
end;
var
fmSelectComPort: TfmSelectComPort;
implementation
{$R *.DFM}
procedure TfmSelectComPort.btnOKClick(Sender: TObject);
var
fIniFile :TIniFile;
iPort:integer;
begin
if cmboComport.ItemIndex>-1 then
begin
iPort:=cmboComport.ItemIndex;
fIniFile :=TIniFile.create(extractFilePath(GetCurrentDir+'\')+'fbus.ini');
fINIFile.writeInteger('COMPORT','PORT',iPort);
fINIFile.free;
self.Close;
end
else
MessageDlg('Please Select a Comport',mtWarning,[mbOk],0);
end;
Procedure TfmSelectComPort.Change;
var
fIniFile :TIniFile;
iPort:integer;
begin
iPort:=cmboComport.ItemIndex;
fIniFile :=TIniFile.create(extractFilePath(GetCurrentDir+'\')+'fbus.ini');
iPort:=fINIFile.ReadInteger('COMPORT','PORT',iPort);
fINIFile.free;
cmboComport.ItemIndex:=iPort;
Showmodal;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -