📄 dlgbytesend.~pas
字号:
unit dlgByteSend;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Buttons;
type
TdlgSetByteSeng = class(TForm)
Panel1: TPanel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
edStart: TEdit;
edEnd: TEdit;
edTime: TEdit;
Label4: TLabel;
edCount: TEdit;
cbIsUse: TCheckBox;
btnOK: TBitBtn;
btnCancel: TBitBtn;
procedure FormShow(Sender: TObject);
procedure btnOKClick(Sender: TObject);
procedure edStartKeyPress(Sender: TObject; var Key: Char);
procedure edTimeKeyPress(Sender: TObject; var Key: Char);
procedure edStartKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure btnCancelClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
procedure Show_ByteSend;
implementation
uses UnitPublic;
{$R *.dfm}
procedure Show_ByteSend;
begin
with TdlgSetByteSeng.Create(application) do
begin
try
showmodal;
finally
Free;
end;
end;
end;
procedure TdlgSetByteSeng.FormShow(Sender: TObject);
begin
LoadByteSend;
with ByteSend do
begin
edStart.Text := UpperCase(inttohex(StartByte,2));
edEnd.Text := UpperCase(inttohex(EndByte,2));
edTime.Text := inttostr(SendIntervel);
edCount.Text := inttostr(SendCount);
cbIsUse.Checked := IsEnable;
end;
end;
procedure TdlgSetByteSeng.btnOKClick(Sender: TObject);
begin
with ByteSend do
begin
StartByte := strtointdef('$'+edStart.Text,$00);
EndByte := strtointdef('$'+edEnd.Text,$FF) ;
SendIntervel := strtointdef(edTime.Text,500);
SendCount := strtointdef(edCount.Text,1);
IsEnable := cbIsUse.Checked ;
end;
SaveByteSend;
close;
end;
procedure TdlgSetByteSeng.edStartKeyPress(Sender: TObject; var Key: Char);
begin
if not(Key in ['0'..'9','a'..'f','A'..'F',#8]) then
begin
key:=#0;
showmessage('输入错误!必须输入0..9,a..f,A..F')
end else
begin
key:=upcase(key);
end;
end;
procedure TdlgSetByteSeng.edTimeKeyPress(Sender: TObject; var Key: Char);
begin
if not(Key in ['0'..'9',#8]) then
begin
key:=#0;
showmessage('输入错误!必须输入0..9')
end;
end;
procedure TdlgSetByteSeng.edStartKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (Key = VK_RETURN) or (Key = VK_DOWN) then
SelectNext(ActiveControl, True, True)
else if Key = VK_UP then
SelectNext(ActiveControl, False, True);
end;
procedure TdlgSetByteSeng.btnCancelClick(Sender: TObject);
begin
close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -