📄 byfsunit.pas
字号:
unit byfsunit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Mask, ExtCtrls;
type
Tbyfs = class(TForm)
Panel1: TPanel;
Label1: TLabel;
Label5: TLabel;
Label2: TLabel;
Label3: TLabel;
Label21: TLabel;
Label4: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label19: TLabel;
Label20: TLabel;
Label22: TLabel;
Label23: TLabel;
Label24: TLabel;
Label25: TLabel;
Edit1: TEdit;
Edit5: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit12: TEdit;
Edit4: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Edit8: TEdit;
Edit9: TEdit;
Edit10: TEdit;
Edit11: TEdit;
Edit13: TEdit;
ComboBox1: TComboBox;
ComboBox2: TComboBox;
Edit14: TEdit;
ComboBox3: TComboBox;
Edit15: TEdit;
MaskEdit1: TMaskEdit;
Edit16: TEdit;
MaskEdit2: TMaskEdit;
Edit17: TEdit;
MaskEdit3: TMaskEdit;
MaskEdit4: TMaskEdit;
Button1: TButton;
procedure Edit1Exit(Sender: TObject);
procedure ComboBox1Exit(Sender: TObject);
procedure ComboBox3Exit(Sender: TObject);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
byfs: Tbyfs;
implementation
uses datadomule;
{$R *.dfm}
procedure Tbyfs.Edit1Exit(Sender: TObject);
begin
with datamodule1.qry_byfs do
begin
close;
sql.clear;
sql.add('select * from xsmc where xsxh_id=:id');
parambyname('id').asstring:=edit1.text;
open;
if recordcount=0 then
begin
application.MessageBox('您输入的学号不存在!','提示',mb_ok+mb_iconinformation);
edit1.clear;
exit;
end;
edit5.text:=fields[5].asstring;
edit2.text:=fields[1].asstring;
edit3.text:=fields[3].asstring;
edit12.text:=fields[2].asstring;
end;
with datamodule1.qry_byfs do
begin
close;
sql.clear;
sql.add('select* from byqk where xsxh_id=:id');
parambyname('id').AsString:=edit1.text;
open;
if findfirst then
begin
application.MessageBox('该学号的学生毕业信息已经存在了!','提示',mb_ok+mb_iconinformation);
edit1.clear;
edit2.clear;
edit3.clear;
edit5.clear;
edit12.clear;
exit;
end;
end;
end;
procedure Tbyfs.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 Tbyfs.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 Tbyfs.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
selectnext (activecontrol,true,true);
end;
procedure Tbyfs.Button1Click(Sender: TObject);
begin
if edit1.text='' then
begin
application.MessageBox('学生学号不能为空!','提示',mb_ok+mb_iconinformation);
exit;
end;
with datamodule1.qry_byfs do
begin
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;
edit1.SetFocus ;
application.MessageBox('该学生毕业信息存储完毕!','提示',mb_ok+mb_iconinformation);
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -