📄 unit1.pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Label1: TLabel;
RadioGroup1: TRadioGroup;
Panel1: TPanel;
Label2: TLabel;
GroupBox1: TGroupBox;
Button1: TButton;
Edit3: TEdit;
GroupBox2: TGroupBox;
Label3: TLabel;
GroupBox3: TGroupBox;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
CheckBox1: TCheckBox;
Label4: TLabel;
ComboBox1: TComboBox;
Edit2: TEdit;
procedure Button1Click(Sender: TObject);
procedure RadioGroup1Click(Sender: TObject);
procedure RadioButton1Click(Sender: TObject);
procedure RadioButton2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var temp:string;
var int_t:real;
begin
if(radiogroup1.ItemIndex=0)then
begin
if(radiobutton1.Checked =true)then
begin
if(checkbox1.Checked =true)then
begin
edit3.Text :=floattostr(256-(strtofloat(edit1.Text)*1000000/(192*strtoint(combobox1.Text))));
end
else
begin
edit3.Text :=floattostr(256-(strtofloat(edit1.Text)*1000000/(384*strtoint(combobox1.Text))));
end;
temp:=floattostr(strtofloat(edit3.Text)-Frac(strtofloat(edit3.Text)));
if(Frac(strtofloat(edit3.Text))>=0.5)then
edit2.Text :=inttohex(strtoint(temp)+1,2)
else
edit2.Text :=inttohex(strtoint(temp),2);
end;
end;
if(radiogroup1.ItemIndex=1)then
begin
if(radiobutton1.Checked =true)then
begin
edit3.Text :=floattostr(65536-(strtofloat(edit1.Text)*1000000/(32*strtoint(combobox1.Text))));
temp:=floattostr(strtofloat(edit3.Text)-Frac(strtofloat(edit3.Text)));
if(Frac(strtofloat(edit3.Text))>=0.5)then
edit2.Text :=inttohex(strtoint(temp)+1,2)
else
edit2.Text :=inttohex(strtoint(temp),2);
end;
end;
if(radiobutton2.Checked =true)then
begin
if(checkbox1.Checked =true)then
edit3.Text :=floattostr(strtofloat(edit1.Text)*1000000/32)
else
edit3.Text :=floattostr(strtofloat(edit1.Text)*1000000/64);
edit2.Text :='HZ';
end;
end;
procedure TForm1.RadioGroup1Click(Sender: TObject);
begin
if(radiogroup1.ItemIndex =0)then
checkbox1.Enabled :=true
else
checkbox1.Enabled :=false;
end;
procedure TForm1.RadioButton1Click(Sender: TObject);
begin
radiogroup1.Enabled :=true;
if(radiogroup1.ItemIndex =0)then
checkbox1.Enabled :=true
else
checkbox1.Enabled :=false;
end;
procedure TForm1.RadioButton2Click(Sender: TObject);
begin
radiogroup1.Enabled :=false;
checkbox1.Enabled :=true;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -