📄 ucomset.pas
字号:
unit Ucomset;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
Tfcomset = class(TForm)
ComboBox1: TComboBox;
Label1: TLabel;
ComboBox2: TComboBox;
Label2: TLabel;
ComboBox3: TComboBox;
Label3: TLabel;
ComboBox4: TComboBox;
Label4: TLabel;
ComboBox5: TComboBox;
Label5: TLabel;
ComboBox6: TComboBox;
Label6: TLabel;
Button1: TButton;
Button2: TButton;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
fcomset: Tfcomset;
implementation
uses umain;
{$R *.dfm}
procedure Tfcomset.Button2Click(Sender: TObject);
begin
close;
end;
procedure Tfcomset.Button1Click(Sender: TObject);
var pcode:array[1..5] of integer;
brate:array[1..10] of integer;
stopb:array[1..3] of integer;
datab:array[1..4] of integer;
begin
pcode[1]:=EVENPARITY;
pcode[2]:=MARKPARITY;
pcode[3]:=NOPARITY;
pcode[4]:=ODDPARITY;
pcode[5]:=SPACEPARITY;
brate[1]:=CBR_300;
brate[2]:=CBR_600;
brate[3]:=CBR_1200;
brate[4]:=CBR_2400;
brate[5]:=CBR_4800;
brate[6]:=CBR_9600;
brate[7]:=CBR_19200;
brate[8]:=CBR_38400;
brate[9]:=CBR_57600;
brate[10]:=CBR_115200;
stopb[1]:=ONESTOPBIT;
stopb[2]:=ONE5STOPBITS;
stopb[3]:=TWOSTOPBITS;
datab[1]:=DATABITS_5;
datab[2]:=DATABITS_6;
datab[3]:=DATABITS_7;
datab[4]:=DATABITS_8;
form1.comnum:=fcomset.ComboBox1.itemindex+1;
form1.baudrate:=brate[fcomset.ComboBox2.itemindex+1];
form1.parity:=pcode[combobox3.ItemIndex+1];
form1.databit:=datab[combobox4.itemindex+1];
form1.stopbit:=stopb[combobox5.itemindex+1];
form1.commstate[1]:=ComboBox1.itemindex;
form1.commstate[2]:=ComboBox2.itemindex;
form1.commstate[3]:=ComboBox3.itemindex;
form1.commstate[4]:=ComboBox4.itemindex;
form1.commstate[5]:=ComboBox5.itemindex;
//form1.flowctl:=combobox6.ItemIndex;
close;
end;
procedure Tfcomset.FormCreate(Sender: TObject);
begin
combobox1.ItemIndex:=form1.commstate[1];
combobox2.ItemIndex:=form1.commstate[2];
combobox3.ItemIndex:=form1.commstate[3];
combobox4.ItemIndex:=form1.commstate[4];
combobox5.ItemIndex:=form1.commstate[5];
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -