📄 byfplrunit.pas
字号:
unit byfplrunit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Mask, DB, DBTables;
type
Tbycpfrm = class(TForm)
Panel1: TPanel;
Label1: TLabel;
Edit1: TEdit;
Label5: TLabel;
Edit5: TEdit;
Label2: TLabel;
Edit2: TEdit;
Label3: TLabel;
Edit3: TEdit;
Label21: TLabel;
Edit12: TEdit;
Label4: TLabel;
Edit4: TEdit;
Label6: TLabel;
Edit6: TEdit;
Label7: TLabel;
Edit7: TEdit;
Label8: TLabel;
Edit8: TEdit;
Label9: TLabel;
Edit9: TEdit;
Label10: TLabel;
Edit10: TEdit;
Label11: TLabel;
Edit11: TEdit;
Label12: TLabel;
Edit13: TEdit;
Label13: TLabel;
Label14: TLabel;
ComboBox1: TComboBox;
Label15: TLabel;
ComboBox2: TComboBox;
Label16: TLabel;
Edit14: TEdit;
Label17: TLabel;
ComboBox3: TComboBox;
Label18: TLabel;
Edit15: TEdit;
Label19: TLabel;
MaskEdit1: TMaskEdit;
Label20: TLabel;
Edit16: TEdit;
Label22: TLabel;
MaskEdit2: TMaskEdit;
Label23: TLabel;
Edit17: TEdit;
qry: TQuery;
DataSource1: TDataSource;
Label24: TLabel;
Label25: TLabel;
MaskEdit3: TMaskEdit;
MaskEdit4: TMaskEdit;
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure ComboBox1Exit(Sender: TObject);
procedure ComboBox3Exit(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
end;
var
bycpfrm: Tbycpfrm;
implementation
uses fplrunit, bycpunit, datadomule;
{$R *.dfm}
procedure Tbycpfrm.FormCreate(Sender: TObject); //显示第一个学生的信息
begin
with qry do
begin
close;
sql.Clear ;
sql.Add('select * from xsmc where bjh0=:id') ;
parambyname('id').asstring:=bycp.combobox2.text;
open;
first;
edit1.text:=fields[0].asstring;
edit2.text:=fields[1].asstring;
edit3.text:=fields[3].asstring;
edit5.text:=fields[5].asstring;
edit12.text:=fields[2].asstring;
end;
end;
procedure Tbycpfrm.ComboBox1Exit(Sender: TObject); //使不需要的选项变灰
begin
if combobox1.text='否' then
begin
combobox2.color:=clWindow;
combobox3.color:=cl3DLight;
edit15.color:=cl3DLight;
edit15.ReadOnly:=true;
edit16.color:=cl3DLight;
edit16.ReadOnly:=true;
maskedit1.Color:=cl3DLight;
maskedit1.ReadOnly:=true;
maskedit2.Color:=cl3DLight;
maskedit2.ReadOnly:=true;
end;
if combobox1.text='是' then
begin
combobox2.color:=cl3DLight;
combobox3.color:=clWindow;
edit15.color:=clWindow;
edit15.ReadOnly:=false;
edit16.color:=clWindow;
edit16.ReadOnly:=false;
maskedit1.Color:=clWindow;
maskedit1.ReadOnly:=false;
maskedit2.Color:=clWindow;
maskedit2.ReadOnly:=false;
end;
end;
procedure Tbycpfrm.ComboBox3Exit(Sender: TObject);
begin
if combobox3.text='否' then
begin
edit15.color:=cl3DLight;
edit15.ReadOnly:=true;
edit16.color:=cl3DLight;
edit16.ReadOnly:=true;
maskedit1.Color:=cl3DLight;
maskedit1.ReadOnly:=true;
maskedit2.Color:=cl3DLight;
maskedit2.ReadOnly:=true;
edit17.color:=clWindow;
edit17.ReadOnly:=false;
end;
if combobox3.text='是' then
begin
edit15.color:=clWindow;
edit15.ReadOnly:=false;
edit16.color:=clWindow;
edit16.ReadOnly:=false;
maskedit1.Color:=clWindow;
maskedit1.ReadOnly:=false;
maskedit2.Color:=clWindow;
maskedit2.ReadOnly:=false;
edit17.color:=cl3DLight;
edit17.ReadOnly:=true;
end;
end;
procedure Tbycpfrm.Button1Click(Sender: TObject); //将数据存入数据库 表byqk
begin
if edit1.text='' then
begin
application.MessageBox('请输入完整信息!','提示',mb_ok+mb_iconinformation);
edit1.SetFocus ;
exit;
end;
with datamodule1.qry_bycp do
begin
close;
sql.Clear;
sql.add('select * from byqk');
open;
edit;
append;
fields[0].asstring:=edit1.text;
fields[1].asstring:=edit2.text;
fields[2].asstring:=edit12.text;
fields[3].asstring:=edit3.text;
fields[4].asstring:=edit4.text;
fields[5].asstring:=edit5.text;
fields[6].asstring:=edit6.text;
fields[7].asstring:=edit7.text;
fields[8].asstring:=edit8.text;
fields[9].asstring:=edit9.text;
fields[10].asstring:=edit10.text;
fields[11].asstring:=edit11.text;
fields[12].asstring:=edit13.text;
fields[13].asstring:=combobox1.text;
fields[14].asstring:=combobox2.text;
fields[15].asstring:=edit14.text;
fields[16].asstring:=combobox3.text;
fields[17].asstring:=edit17.text;
fields[18].asstring:=edit15.text;
fields[19].asstring:=maskedit1.text;
fields[20].asstring:=edit16.text;
fields[21].asstring:=maskedit2.text;
fields[22].asstring:=maskedit3.text;
fields[23].asstring:=maskedit4.text;
post;
end;
with qry do
begin
next;
edit1.text:=fields[0].asstring;
edit2.text:=fields[1].asstring;
edit3.text:=fields[3].asstring;
edit5.text:=fields[5].asstring;
edit12.text:=fields[2].asstring;
if eof then
application.MessageBox('该班级毕业信息输入已经完成!','提示',mb_ok+mb_iconinformation);
end;
edit4.clear;
edit6.clear;
edit7.clear;
edit8.clear;
edit9.clear;
edit10.clear;
edit11.clear;
edit13.clear;
edit14.clear;
edit15.clear;
edit16.clear;
edit17.clear;
maskedit1.Text:='0000-00';
maskedit2.Text:='0000-00';
edit4.SetFocus ;
end;
procedure Tbycpfrm.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
selectnext( activecontrol,true,true);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -