📄 khjkdysz.pas
字号:
unit khjkdysz;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons,khjkbb;
type
Tf_khjkdysz = class(TForm)
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label5: TLabel;
Label17: TLabel;
Label18: TLabel;
Label21: TLabel;
Label19: TLabel;
Label23: TLabel;
Label24: TLabel;
khmc: TEdit;
czje: TEdit;
czzr: TEdit;
fkhj: TEdit;
hzds: TEdit;
jkph: TEdit;
sj: TEdit;
ljyfk: TEdit;
fkr: TEdit;
je: TEdit;
GroupBox2: TGroupBox;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label15: TLabel;
Label16: TLabel;
btgd: TEdit;
btjj: TEdit;
Gridjj: TEdit;
dqfs: TComboBox;
admjj: TEdit;
timejj: TEdit;
GroupBox3: TGroupBox;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
Label14: TLabel;
SpeedButton4: TSpeedButton;
BitBtn1: TBitBtn;
FontSet: TFontDialog;
procedure jkphKeyPress(Sender: TObject; var Key: Char);
procedure jkphExit(Sender: TObject);
procedure hzdsExit(Sender: TObject);
procedure hzdsKeyPress(Sender: TObject; var Key: Char);
procedure BitBtn1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure SpeedButton4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
f_khjkdysz: Tf_khjkdysz;
implementation
{$R *.dfm}
procedure Tf_khjkdysz.jkphKeyPress(Sender: TObject; var Key: Char);
var
i: Boolean;
begin
i := (Key<#8)or(Key>#8)and(Key<#46)or(Key>#46)and(Key<#48)or(Key>#57);
if i then
Key := #0;
end;
procedure Tf_khjkdysz.jkphExit(Sender: TObject);
begin
if Sender is TEdit then
if Trim(TEdit(Sender).Text)<>'' then
begin
Try
StrToFloat(TEdit(Sender).Text);
Except
Application.MessageBox('请输入合法数据.','提示',64);
TEdit(Sender).Text := '1.0';
end;
if StrToFloat(TEdit(Sender).Text)=0 then
TEdit(Sender).Text := '1.0';
end
else
TEdit(Sender).Text := '1.0';
end;
procedure Tf_khjkdysz.hzdsExit(Sender: TObject);
begin
if Sender is TEdit then
if Trim(TEdit(Sender).Text)<>'' then
begin
Try
StrToInt(TEdit(Sender).Text);
except
Application.MessageBox('请输入合法数据.','提示',64);
TEdit(Sender).Text := '8';
end;
if StrToFloat(TEdit(Sender).Text)=0 then
TEdit(Sender).Text := '8';
end
else
TEdit(Sender).Text := '8';
end;
procedure Tf_khjkdysz.hzdsKeyPress(Sender: TObject; var Key: Char);
var
i: Boolean;
begin
i := (Key<#8)or(Key>#8)and(Key<#48)or(Key>#57);
if i then
Key := #0;
end;
procedure Tf_khjkdysz.BitBtn1Click(Sender: TObject);
var
i: Integer;
begin
Azdkd[0] := StrToFloat(jkph.Text);
Azdkd[1] := StrToFloat(khmc.Text);
Azdkd[2] := StrToFloat(fkhj.Text);
Azdkd[3] := StrToFloat(czzr.Text);
Azdkd[4] := StrToFloat(ljyfk.Text);
Azdkd[5] := StrToFloat(czje.Text);
Azdkd[6] := StrToFloat(fkr.Text);
Azdkd[7] := StrToFloat(sj.Text);
Sumzdkd := 0;
if (StrToInt(hzds.Text)<=0)or(StrToInt(hzds.Text)>zds)then
begin
Application.MessageBox('每行字段数不能大于表格字段数.','提示',64);
Cols := zds;
end
else
Cols := StrToInt(hzds.Text);
For i := 0 to 5 do
Sumzdkd := Sumzdkd+Azdkd[i];
Rowzdkd := Cols*(Sumzdkd/6);
with Content do
begin
TitleHeight:= StrToFloat(btgd.Text);
BtHeight:= StrToFloat(btjj.Text);
Bgjj:= StrToFloat(Gridjj.Text);
Czyjj:= StrToFloat(admjj.Text);
sjjj:= StrToFloat(timejj.Text);
Bgdqfs:= dqfs.ItemIndex;
end;
Close;
end;
procedure Tf_khjkdysz.FormCreate(Sender: TObject);
begin
jkph.Text := FloatToStr(Azdkd[0]);
khmc.Text := FloatToStr(Azdkd[1]);
fkhj.Text := FloatToStr(Azdkd[2]);
czzr.Text := FloatToStr(Azdkd[3]);
ljyfk.Text := FloatToStr(Azdkd[4]);
czje.Text := FloatToStr(Azdkd[5]);
fkr.Text := FloatToStr(Azdkd[6]);
sj.Text := FloatToStr(Azdkd[7]);
hzds.Text := IntToStr(Cols);
with Content do
begin
btgd.Text:= FloatToStr(TitleHeight);
btjj.Text:= FloatToStr(BtHeight);
Gridjj.Text:= FloatToStr(Bgjj);
admjj.Text:= FloatToStr(Czyjj);
timejj.Text:= FloatToStr(sjjj);
dqfs.ItemIndex:= Bgdqfs;
end;
end;
procedure Tf_khjkdysz.SpeedButton1Click(Sender: TObject);
begin
if FontSet.Execute = True then
with TitleFont do
begin
RFontName := FontSet.Font.Name;
RFontSize := FontSet.Font.Size;
RFontStyle := FontSet.Font.Style;
RFontColor := FontSet.Font.Color;
end;
end;
procedure Tf_khjkdysz.SpeedButton2Click(Sender: TObject);
begin
if FontSet.Execute = True then
with BtFont do
begin
RFontName := FontSet.Font.Name;
RFontSize := FontSet.Font.Size;
RFontStyle := FontSet.Font.Style;
RFontColor := FontSet.Font.Color;
end;
end;
procedure Tf_khjkdysz.SpeedButton3Click(Sender: TObject);
begin
if FontSet.Execute = True then
with BgTitleFont do
begin
RFontName := FontSet.Font.Name;
RFontSize := FontSet.Font.Size;
RFontStyle := FontSet.Font.Style;
RFontColor := FontSet.Font.Color;
end;
end;
procedure Tf_khjkdysz.SpeedButton4Click(Sender: TObject);
begin
if FontSet.Execute = True then
with BgFont do
begin
RFontName := FontSet.Font.Name;
RFontSize := FontSet.Font.Size;
RFontStyle := FontSet.Font.Style;
RFontColor := FontSet.Font.Color;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -