⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 untbaudset.~pas

📁 显示当前采集的10个测量点的路温湿度值: 温度单位是℃
💻 ~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;
       oldBaud := 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 + -