Unit3.pas
上传用户:szyozho
上传日期:2013-04-13
资源大小:3688k
文件大小:5k
源码类别:

教育系统应用

开发平台:

Delphi

  1. unit Unit3;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs, Menus, ExtCtrls, ComCtrls, StdCtrls, DB, DBTables, jpeg;
  6. type
  7.   Tmainform = class(TForm)
  8.     MainMenu1: TMainMenu;
  9.     N1: TMenuItem;
  10.     N2: TMenuItem;
  11.     N3: TMenuItem;
  12.     N4: TMenuItem;
  13.     N6: TMenuItem;
  14.     N7: TMenuItem;
  15.     N8: TMenuItem;
  16.     StatusBar1: TStatusBar;
  17.     Timer1: TTimer;
  18.     Panel1: TPanel;
  19.     Label2: TLabel;
  20.     Query3: TQuery;
  21.     Query3qx: TStringField;
  22.     N10: TMenuItem;
  23.     N9: TMenuItem;
  24.     N13: TMenuItem;
  25.     N14: TMenuItem;
  26.     N15: TMenuItem;
  27.     N16: TMenuItem;
  28.     N17: TMenuItem;
  29.     Image1: TImage;
  30.     N5: TMenuItem;
  31.     N11: TMenuItem;
  32.     N12: TMenuItem;
  33.     N18: TMenuItem;
  34.     N19: TMenuItem;
  35.     procedure N8Click(Sender: TObject);
  36.     procedure N7Click(Sender: TObject);
  37.     procedure N6Click(Sender: TObject);
  38.     procedure N4Click(Sender: TObject);
  39.     procedure FormCreate(Sender: TObject);
  40.    // procedure Timer1Timer(Sender: TObject);
  41.     procedure FormActivate(Sender: TObject);
  42.     procedure Timer1Timer(Sender: TObject);
  43.     procedure N9Click(Sender: TObject);
  44.     procedure N13Click(Sender: TObject);
  45.     procedure N14Click(Sender: TObject);
  46.     procedure N15Click(Sender: TObject);
  47.     procedure N16Click(Sender: TObject);
  48.     procedure N17Click(Sender: TObject);
  49.     procedure N3Click(Sender: TObject);
  50.     procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  51.     procedure N12Click(Sender: TObject);
  52.     procedure N18Click(Sender: TObject);
  53.     procedure N19Click(Sender: TObject);
  54.  //   procedure FormCreate(Sender: TObject);
  55.   private
  56.     { Private declarations }
  57.   public
  58.  password,username:string;
  59. // papertime:integer;
  60.  updateno:integer;
  61.     { Public declarations }
  62.   end;
  63. var
  64.   mainform: Tmainform;
  65.   havelogin:boolean;
  66. implementation
  67. uses Unit2,Unit4,Unit5,Unit1, Unit6, Unit7, Unit8, Unit9, Unit10, Unit11,
  68.   Unit12, Unit15, Unit16, Unit17, Unit21, Unit20;
  69. {$R *.dfm}
  70. procedure Tmainform.N8Click(Sender: TObject);
  71. begin
  72. if (messagedlg('确认要退出系统吗 ?',mtconfirmation,[mbyes,mbno],0))=mryes then
  73. application.Terminate;
  74.  end;
  75. procedure Tmainform.N7Click(Sender: TObject);
  76. begin
  77. restoreform.show;
  78. end;
  79. procedure Tmainform.N6Click(Sender: TObject);
  80. begin
  81. backupform.Show;
  82. end;
  83. procedure Tmainform.N4Click(Sender: TObject);
  84. begin
  85. changemi.show;
  86. end;
  87. procedure Tmainform.FormCreate(Sender: TObject);
  88. Const
  89.   count=2000;//显示欢迎窗体的最少时间(毫秒)
  90. var
  91.  st,et:Integer;
  92. begin
  93. //papertime:=0;
  94. havelogin:=false;
  95. label2.Caption:='欢迎使用通用试卷生成系统!            ';
  96. Label2.Left:=300;
  97. statusbar1.Panels[2].Text:=DateToStr(Date);
  98.  statusbar1.Panels[3].Text:=TimeToStr(time);
  99.   //记录开始时间
  100.  st:=GetTickCount;
  101.   welcomeform:=Twelcomeform.Create(Application);
  102.   welcomeform.Show;
  103.   welcomeform.Update;
  104.   //初始化程序
  105.   //记录结束时间
  106.   et:=GetTickCount;
  107.   if et-st<count then //是否显示够了规定时间
  108.     Sleep(count-(et-st));
  109.   welcomeform.Close;
  110.   welcomeform.Free;
  111. //if query3.FieldByName('qx').AsString ='b' then
  112. //form3.N3.Enabled:=false;
  113. //else
  114. //if query3.FieldByName('qx').AsString ='a' then
  115. //form3.N3.Visible:=true;
  116. end;
  117. procedure Tmainform.FormActivate(Sender: TObject);
  118. var
  119. t:integer;
  120. begin
  121. if not havelogin then
  122. begin
  123. loginform.show;
  124. end;
  125.    t:=StatusBar1.Top+2;
  126.    Panel1.Top:=t;
  127. //if query3.FieldByName('qx').AsString ='b' then
  128. //form3.N3.Visible:=false ;
  129. //else
  130. //if query3.FieldByName('qx').AsString ='a' then
  131. //form3.N3.Visible:=true;
  132. end;
  133. procedure Tmainform.Timer1Timer(Sender: TObject);
  134. begin
  135. //字幕从左向右移动,这儿可以修改成任意方向的
  136.    //移动,请读者自己完成。
  137.    label2.Left:=label2.Left -1;
  138.    ///当整个label移动出了panel的边界后,
  139.    //重新开始
  140.     if(label2.Left<=-180 ) then
  141.      label2.Left :=300;
  142.  //  if(label2.Left>=StatusBar1.Panels[0].Width ) then
  143.     // label2.Left :=-label2.Width;
  144. end;
  145. procedure Tmainform.N9Click(Sender: TObject);
  146. begin
  147. chooseform.show;
  148. end;
  149. procedure Tmainform.N13Click(Sender: TObject);
  150. begin
  151. filltextform.show;
  152. end;
  153. procedure Tmainform.N14Click(Sender: TObject);
  154. begin
  155. judgeform.show;
  156. end;
  157. procedure Tmainform.N15Click(Sender: TObject);
  158. begin
  159. readproform.show;
  160. end;
  161. procedure Tmainform.N16Click(Sender: TObject);
  162. begin
  163. definepaperform.show;
  164. DataModule4.Table_shijuan.Close;
  165. DataModule4.Table_shijuan.Open;
  166. end;
  167. procedure Tmainform.N17Click(Sender: TObject);
  168. begin
  169. procedureform.show;
  170. end;
  171. procedure Tmainform.N3Click(Sender: TObject);
  172. begin
  173. DataModule4.Table_u.Close;
  174. DataModule4.Table_u.Open;
  175. usermanage.Show;
  176. end;
  177. procedure Tmainform.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  178. begin
  179. if (messagedlg('确认要退出系统吗 ?',mtconfirmation,[mbyes,mbno],0))=mryes then
  180. application.Terminate;
  181. end;
  182. procedure Tmainform.N12Click(Sender: TObject);
  183. begin
  184. loginform.ComboBox1.Text:='';
  185. loginform.Edit1.Text:='';
  186. loginform.Show;
  187. end;
  188. procedure Tmainform.N18Click(Sender: TObject);
  189. begin
  190. rightform.Show;
  191. end;
  192. procedure Tmainform.N19Click(Sender: TObject);
  193. begin
  194. papermanageform.Show;
  195. end;
  196. end.