Am_ylj_bjs.~pas
资源名称:挡案管理系统.rar [点击查看]
上传用户:szruida
上传日期:2007-06-01
资源大小:6518k
文件大小:4k
源码类别:
Delphi控件源码
开发平台:
Delphi
- unit Am_ylj_bjs;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, ExtCtrls, DB, StdCtrls, Mask, DBCtrls, Buttons, DBCtrlsEh,
- TFlatHintUnit;
- type
- TAm_ylj_bj = class(TForm)
- Panel1: TPanel;
- Label1: TLabel;
- ds_ajgl: TDataSource;
- Label2: TLabel;
- Label3: TLabel;
- Label4: TLabel;
- Label5: TLabel;
- DBMemo1: TDBMemo;
- Label6: TLabel;
- L_bgqx: TDBLookupComboBox;
- L_mj: TDBLookupComboBox;
- SpeedButton1: TSpeedButton;
- SpeedButton2: TSpeedButton;
- DBEditEh1: TDBEditEh;
- DBEditEh2: TDBEditEh;
- DBEditEh3: TDBEditEh;
- FlatHint1: TFlatHint;
- Label7: TLabel;
- Label8: TLabel;
- Label9: TLabel;
- procedure SpeedButton2Click(Sender: TObject);
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- procedure SpeedButton1Click(Sender: TObject);
- procedure FormShow(Sender: TObject);
- procedure DBMemo1MouseDown(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer);
- procedure DBMemo1KeyPress(Sender: TObject; var Key: Char);
- procedure DBMemo1KeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Am_ylj_bj: TAm_ylj_bj;
- cpos,Lpos,linelength:integer;
- implementation
- uses DMs,am_yljs,u_public, ajgls;
- {$R *.dfm}
- procedure TAm_ylj_bj.SpeedButton2Click(Sender: TObject);
- begin
- close;
- end;
- procedure TAm_ylj_bj.FormClose(Sender: TObject; var Action: TCloseAction);
- begin
- am_ylj_bj:=nil;
- action:=cafree;
- end;
- procedure TAm_ylj_bj.SpeedButton1Click(Sender: TObject);
- begin
- dm.Am_ajgl.Edit;
- dm.Am_ajgl.FieldByName('ajzt_mc').AsString:='预立卷';
- dm.Am_ajgl.FieldByName('ajlb_dm').AsString:=am_ylj.epos1;
- dm.Am_ajgl.ApplyUpdates(0);
- if dm.Am_ajgl.ApplyUpdates(0)=0 then
- begin
- application.MessageBox('数据保存成功','提示',mb_ok+mb_iconinformation);
- am_ylj.ToolButton1.Click;
- am_ylj.xiugai.Enabled:=true;
- am_ylj.dele1.Enabled:=true;
- am_ylj.ToolButton1.Enabled:=true;
- am_ylj.WJCZ.Enabled:=true;
- am_ylj.YLJ1.Enabled:=true;
- close;
- end
- else
- begin
- application.MessageBox('数据保存失败','提示',mb_ok+mb_iconinformation);
- end;
- end;
- procedure TAm_ylj_bj.FormShow(Sender: TObject);
- var now1:Tdatetime;
- year,month,day:word;
- s1,s2:string;
- epos:integer;
- begin
- now1:=date();
- decodedate(now1,year,month,day);
- dbediteh2.Text:=inttostr(year);
- dbediteh3.Text:=user_name;
- s1:=am_ylj.Tree.Selected.Text;
- Epos:=pos('-',s1);
- s2:=copy(ylj_s1,0,Epos-1);//案卷类别代码
- dm.sz_ajlb.Close;
- dm.sz_ajlb.CommandText:='select * from sz_ajlb where ajlb_dm='+''''+s2+''''+'';
- dm.sz_ajlb.Open;
- dbediteh1.Text:=dm.sz_ajlb.FieldByName('ajlb_mc').AsString;//将案卷类别代码赋给
- end; //dbediteh1
- procedure TAm_ylj_bj.DBMemo1MouseDown(Sender: TObject;
- Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
- begin
- Lpos:=sendmessage(dbmemo1.Handle,em_linefromchar,dbmemo1.SelStart,0);
- Cpos:=sendmessage(dbmemo1.Handle,em_lineindex,lpos,0);
- linelength:=sendmessage(dbmemo1.Handle,em_linelength,cpos,0);
- cpos:=dbmemo1.SelStart-cpos;
- end;
- procedure TAm_ylj_bj.DBMemo1KeyPress(Sender: TObject; var Key: Char);
- begin
- if (Cpos>76)or(linelength>76)then
- begin
- key:=#13;
- lpos:=lpos+1;
- cpos:=1;
- linelength:=1;
- end;
- end;
- procedure TAm_ylj_bj.DBMemo1KeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- begin
- lpos:=SendMessage(dbMemo1.Handle,EM_linefromchar,dbmemo1.SelStart,0);
- Cpos:=Sendmessage(dbmemo1.Handle,em_lineindex,lpos,0);
- Linelength:=Sendmessage(dbmemo1.Handle,em_linelength,cpos,0);
- Cpos:=dbmemo1.SelStart-Cpos;
- end;
- end.