📄 unit2.pas
字号:
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, DBTables, Grids, DBGrids, Buttons, ExtCtrls,
DBCtrls, ComCtrls;
type
TForm2 = class(TForm)
Button2: TButton;
Memo1: TMemo;
Edit1: TEdit;
ComboBox1: TComboBox;
DataSource1: TDataSource;
Table1: TTable;
SpeedButton1: TSpeedButton;
Label1: TLabel;
Label2: TLabel;
DBGrid1: TDBGrid;
ProgressBar1: TProgressBar;
procedure Button2Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.Button2Click(Sender: TObject);
begin
if messagedlg('洪福鑫提醒您:确认退出?',mtconfirmation,[mbYes,mbNo],0)=mryes
then close;
end;
procedure TForm2.SpeedButton1Click(Sender: TObject);
var
bookmark1:tbookmark;
i:integer;
begin
//table1.refresh;
for i:=0 to 10 do
begin
//ProgressBar1.
ProgressBar1.Step:=20;
ProgressBar1.Min:=0;
ProgressBar1.Max:=20;
//ProgressBar1.Smooth:=True;
ProgressBar1.StepIt;
sleep(50);
//ProgressBar1.Position:=0;
end;
with table1 do
try
disablecontrols;
filtered:=false;
if ComboBox1.text='按车次号查询'then memo1.Text:='车次号='+''''+edit1.Text+'''';
if ComboBox1.text='按起点查询' then memo1.Text:='起点='+''''+edit1.Text+'''';
if ComboBox1.text='按终点查询' then memo1.Text:='终点='+''''+edit1.Text+'''';
if ComboBox1.text='按日期查询' then memo1.Text:='日期='+''''+edit1.Text+'''';
filter:=memo1.text;
filtered:=true;
finally
enablecontrols;
if table1.recordcount=0 then begin
messagebeep(1);
showmessage('没有符合条件的记录!');
if messageDlg('是否继续查询?!',mtinformation,[mbYes,mbNo],0)=mrno then begin
filtered:=false;
// table1.close;
table1.open;
end;
end else begin
showmessage('记录已经找到并显示在表格中,请查看!点击OK将关闭查询结果!');
bookmark1:=table1.getbookmark;
filtered:=false;
// table1.close;
table1.open;
end;
ProgressBar1.Position:=0;
end;
// Query1.SQL.Add('select * from hfxtable where hfxtable.车次号=Edit1.text');
//Query1.DatabaseName:='hfx';
// Query1.Active:=true;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -