3.3 设备保养主界面与代码设计实现 内容来自论文无忧网 www.paper51.com
内容来自www.paper51.com 代码设计: 内容来自www.paper51.com unit Unit1; 内容来自论文无忧网 www.paper51.com interface copyright paper51.com uses http://www.paper51.com Windows,Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, copyright paper51.com Dialogs,ExtCtrls, StdCtrls, Grids, DBGrids, DBCtrls, ADODB, DB, Buttons, 内容来自www.paper51.com ComCtrls,Menus, ImgList, ToolWin, XPMenu,inifiles; http://www.paper51.com type copyright paper51.com
Tfrmmaintable = class(TForm) copyright paper51.com adoque: TADOQuery; http://www.paper51.com
adoqueDSDesigner: TWideStringField; http://www.paper51.com adoqueDSDesigner2: TWideStringField; copyright paper51.com adoqueDSDesigner3: TWideStringField; copyright paper51.com
adoqueDSDesigner4: TWideStringField; copyright paper51.com adoqueDSDesigner5: TWideStringField; copyright paper51.com adoqueDSDesigner6: TWideStringField; copyright paper51.com
adoqueDSDesigner7: TWideStringField; paper51.com
adods: TDataSource; paper51.com Label3: TLabel; http://www.paper51.com ToolBar1: TToolBar; http://www.paper51.com
ImageList1: TImageList; 内容来自www.paper51.com tblfirst: TToolButton; copyright paper51.com tblpri: TToolButton; 内容来自www.paper51.com tblnext: TToolButton; 内容来自论文无忧网 www.paper51.com tbllast: TToolButton; copyright paper51.com ToolButton2: TToolButton; 内容来自论文无忧网 www.paper51.com tbladd: TToolButton; copyright paper51.com tbldel: TToolButton; paper51.com tbledt: TToolButton; 内容来自论文无忧网 www.paper51.com
tblok: TToolButton; paper51.com
tblcancel: TToolButton; 内容来自www.paper51.com tblref: TToolButton; 内容来自www.paper51.com ToolButton1: TToolButton; copyright paper51.com tblprint: TToolButton; http://www.paper51.com tblclose: TToolButton; copyright paper51.com Panel1: TPanel; copyright paper51.com Label1: TLabel; 内容来自论文无忧网 www.paper51.com
Label2: TLabel; http://www.paper51.com
cbotype: TComboBox; paper51.com cboarea: TComboBox; copyright paper51.com Label4: TLabel; copyright paper51.com
dbgrid: TDBGrid; paper51.com cbounit: TComboBox; 内容来自www.paper51.com Label5: TLabel; 内容来自论文无忧网 www.paper51.com
cboorderby: TComboBox; paper51.com
Shape1: TShape; 内容来自论文无忧网 www.paper51.com adoqueDSDesigner10: TWideStringField; http://www.paper51.com adoqueDSDesigner11: TWideStringField; copyright paper51.com procedure FormCreate(Sender: TObject); copyright paper51.com procedure cboareaChange(Sender: TObject); copyright paper51.com procedure cbotypeChange(Sender: TObject); http://www.paper51.com procedure mnudataClick(Sender: TObject); 内容来自论文无忧网 www.paper51.com
procedure mnufileprintpreClick(Sender:TObject); 内容来自www.paper51.com procedure tblfirstClick(Sender: TObject); paper51.com procedure tblpriClick(Sender: TObject); 内容来自论文无忧网 www.paper51.com procedure tblnextClick(Sender: TObject); 内容来自www.paper51.com procedure tbllastClick(Sender: TObject); 内容来自www.paper51.com procedure tbladdClick(Sender: TObject); copyright paper51.com procedure tbldelClick(Sender: TObject); copyright paper51.com
procedure tbledtClick(Sender: TObject); 内容来自论文无忧网 www.paper51.com proceduretblokClick(Sender: TObject); http://www.paper51.com procedure tblcancelClick(Sender: TObject); http://www.paper51.com procedure tblrefClick(Sender: TObject); copyright paper51.com procedure tbltableClick(Sender: TObject); 内容来自www.paper51.com
procedure tblprintClick(Sender: TObject); paper51.com
procedure tblcloseClick(Sender: TObject); paper51.com procedure FormClose(Sender: TObject; varAction: TCloseAction); paper51.com procedure cbounitChange(Sender: TObject); copyright paper51.com
procedure FormActivate(Sender: TObject); 内容来自论文无忧网 www.paper51.com procedure dbgridDrawColumnCell(Sender: TObject;const Rect: TRect; http://www.paper51.com DataCol:Integer; Column: TColumn; State: TGridDrawState); http://www.paper51.com procedure cbounitClick(Sender: TObject); paper51.com procedure cboorderbyChange(Sender: TObject); http://www.paper51.com private paper51.com
{ Private declarations } 内容来自论文无忧网 www.paper51.com
public 内容来自www.paper51.com { Public declarations } copyright paper51.com end; copyright paper51.com
var 内容来自论文无忧网 www.paper51.com frmmaintable: Tfrmmaintable; copyright paper51.com myinifile:tinifile; //声明INI文件 http://www.paper51.com
tablename:string; //当前查询表格的名称 内容来自www.paper51.com
savesql:string;//当前执行的SQL语句的内容 内容来自www.paper51.com implementation 内容来自www.paper51.com
uses Unit2, Unit3,unit5; 内容来自论文无忧网 www.paper51.com const 内容来自论文无忧网 www.paper51.com
ScreenWidth: LongInt = 800; 内容来自www.paper51.com
ScreenHeight: LongInt = 600; 内容来自论文无忧网 www.paper51.com
{$R *.dfm} 内容来自www.paper51.com procedure Tfrmmaintable.FormCreate(Sender: TObject); 内容来自www.paper51.com begin paper51.com myinifile:=tinifile.Create(extractfilepath(paramstr(0))+'data.ini'); paper51.com myinifile.ReadSection('username',(dbgrid.Columns.Items[5].PickList));//读取INI文件中的用户 http://www.paper51.com myinifile.ReadSection('username',(dbgrid.Columns.Items[6].PickList)); 内容来自www.paper51.com myinifile.ReadSection('area',(dbgrid.Columns.Items[1].PickList)); 内容来自论文无忧网 www.paper51.com frmmaintable.Height:=300; //初始窗体大小 paper51.com frmmaintable.Width:=500; http://www.paper51.com scaled := true; //根据分辩率调整荧幕大小 内容来自www.paper51.com if (screen.width <> ScreenWidth) then paper51.com begin 内容来自论文无忧网 www.paper51.com height := longint(height) *longint(screen.height) div ScreenHeight; paper51.com width := longint(width) * longint(screen.width)div ScreenWidth; 内容来自论文无忧网 www.paper51.com scaleBy(screen.width, ScreenWidth); paper51.com end; copyright paper51.com adoque.Connection:=frmmain.adocon; //建立数据链接 copyright paper51.com adoque.SQL.Clear; 内容来自www.paper51.com tablename:='e_table'; http://www.paper51.com adoque.SQL.Add('select * from '+tablename); 内容来自论文无忧网 www.paper51.com adoque.Open; 内容来自论文无忧网 www.paper51.com
adods.DataSet:=adoque; paper51.com dbgrid.DataSource:=adods; http://www.paper51.com savesql:=adoque.SQL.Text; //保存当前查询语句的内容 http://www.paper51.com frmmain.statusbar1.Panels[1].Text:='共有'+inttostr(adoque.RecordCount)+'条信息' ; 内容来自www.paper51.com end; 内容来自论文无忧网 www.paper51.com procedure Tfrmmaintable.cboareaChange(Sender: TObject); 内容来自论文无忧网 www.paper51.com
begin 内容来自论文无忧网 www.paper51.com with adoque do http://www.paper51.com
begin paper51.com if cboarea.Text='ALL' then http://www.paper51.com
begin copyright paper51.com close; paper51.com sql.clear; copyright paper51.com sql.Add('select * from '+tablename); paper51.com open; 内容来自www.paper51.com
savesql:=adoque.SQL.Text; //保存当前查询语句的内容 http://www.paper51.com frmmain.statusbar1.Panels[1].Text:='共有'+inttostr(adoque.RecordCount)+'条信息' 内容来自www.paper51.com end paper51.com else 内容来自www.paper51.com begin paper51.com close; 内容来自www.paper51.com sql.clear; paper51.com
sql.Add('select * from e_table where 区域 = '+'"'+cboarea.Text+'"' ); copyright paper51.com open; paper51.com savesql:=adoque.SQL.Text; //保存当前查询语句的内容:=adoque.SQL.Text; //保存当前查询语句的内容 paper51.com frmmain.statusbar1.Panels[1].Text:='共查询到'+inttostr(adoque.RecordCount)+'条信息' paper51.com end; 内容来自www.paper51.com end; 内容来自论文无忧网 www.paper51.com end; copyright paper51.com
|