📄 untbaudset.pas
字号:
unit untBaudSet;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TfrmBaudSet = class(TForm)
Label1: TLabel;
ComboBox1: TComboBox;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmBaudSet: TfrmBaudSet;
oldBaudIndex : Integer; // 原来的波特率
implementation
uses
LoginForm, untDMmain;
{$R *.dfm}
procedure TfrmBaudSet.Button1Click(Sender: TObject);
begin
if ComboBox1.ItemIndex =0 then setBaud := '1200';
if ComboBox1.ItemIndex =1 then setBaud := '4800';
if ComboBox1.ItemIndex =2 then setBaud := '9600';
if ComboBox1.ItemIndex =3 then setBaud := '11200';
if oldBaudIndex <> ComboBox1.ItemIndex then
begin
try
DMmain.ADOTblSysBaud.Open;
DMmain.ADOTblSysBaud.Refresh;
DMmain.ADOTblSysBaud.edit;
DMmain.ADOTblSysBaud.append;
DMmain.ADOTblSysBaud.Fields[1].value := setBaud; // baud
DMmain.ADOTblSysBaud.post;
DMmain.ADOTblSysBaud.close;
except
end;
end;
// 关闭窗体
close;
end;
procedure TfrmBaudSet.FormShow(Sender: TObject);
begin
if setBaud = '1200' then
begin
ComboBox1.ItemIndex :=0;
oldBaudIndex := 0;
end;
if setBaud = '4800' then
begin
ComboBox1.ItemIndex :=1;
oldBaudIndex := 1;
end;
if setBaud = '9600' then
begin
ComboBox1.ItemIndex :=2;
oldBaudIndex := 2;
end;
if setBaud = '11200' then
begin
ComboBox1.ItemIndex :=3;
oldBaudIndex := 3;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -