?? unit2.pas
字號(hào):
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, SPComm;
type
TForm2 = class(TForm)
GroupBox1: TGroupBox;
BitBtn1: TBitBtn;
Label1: TLabel;
ComboBoxCom: TComboBox;
Label2: TLabel;
ComboBoxB: TComboBox;
Label3: TLabel;
Label4: TLabel;
Comm1: TComm;
ComboBoxBytesize: TComboBox;
ComboBoxStopBits: TComboBox;
Label5: TLabel;
ComboBoxParity: TComboBox;
CheckBoxParityCheck: TCheckBox;
procedure BitBtn1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure CheckBoxParityCheckClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
uses Unit1;
{$R *.dfm}
procedure TForm2.BitBtn1Click(Sender: TObject);
begin
with form1 do
begin
CurrentComPort := ComboBoxCom.text;
CurrentBaudRate := StrToInt(ComboBoxB.Text);
CurrentBytesize := TByteSize(ComboBoxBytesize.itemIndex);
CurrentStopBits := TStopBits(ComboBoxStopBits.itemIndex);
if CheckBoxParityCheck.Checked then
begin
CurrentParityCheck := true;
CurrentParity := TParity(ComboBoxParity.ItemIndex);
end
else
begin
CurrentParityCheck := false;
CurrentParity := None;
end;
//////////
CurrentOutx_CtsFlow := false;
CurrentOutx_DsrFlow := false;
CurrentOutx_XonXoffFlow := False;
//////////
InitCom;
end;
Close;
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
ComboBoxCom.ItemIndex := 0;
ComboBoxB.ItemIndex := 3;
end;
procedure TForm2.FormShow(Sender: TObject);
begin
//Init Show
with Form1 do
begin
ComboBoxBytesize.ItemIndex := Byte(CurrentBytesize);
ComboBoxStopBits.ItemIndex := Byte(CurrentStopBits);
if CurrentParityCheck then
begin
CheckBoxParityCheck.Checked := true;
ComboBoxParity.Enabled := true;
ComboBoxParity.ItemIndex := Byte(CurrentParity);
end
else
begin
CheckBoxParityCheck.Checked := false;
ComboBoxParity.Enabled := false;
ComboBoxParity.ItemIndex := Byte(CurrentParity);
end;
end;
end;
procedure TForm2.CheckBoxParityCheckClick(Sender: TObject);
begin
if CheckBoxParityCheck.Checked then
ComboBoxParity.Enabled := true
else
ComboBoxParity.Enabled := false;
end;
end.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -