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

教育系统应用

开发平台:

Delphi

  1. unit Unit17;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs, StdCtrls, Menus, DB, DBTables;
  6. type
  7.   Tpapermadeform = class(TForm)
  8.     MainMenu1: TMainMenu;
  9.     N3: TMenuItem;
  10.     N24: TMenuItem;
  11.     N26: TMenuItem;
  12.     N5: TMenuItem;
  13.     N19: TMenuItem;
  14.     N6: TMenuItem;
  15.     N21: TMenuItem;
  16.     FontDialog1: TFontDialog;
  17.     Memo1: TMemo;
  18.     N1: TMenuItem;
  19.     Query1: TQuery;
  20.     N4: TMenuItem;
  21.     N7: TMenuItem;
  22.     N8: TMenuItem;
  23.     N9: TMenuItem;
  24.     N10: TMenuItem;
  25.     N11: TMenuItem;
  26.     procedure N22Click(Sender: TObject);
  27.     procedure N26Click(Sender: TObject);
  28.     procedure U1Click(Sender: TObject);
  29.     procedure N12Click(Sender: TObject);
  30.     procedure N13Click(Sender: TObject);
  31.     procedure N14Click(Sender: TObject);
  32.     procedure N16Click(Sender: TObject);
  33.     procedure N19Click(Sender: TObject);
  34.     procedure N24Click(Sender: TObject);
  35.     procedure N1Click(Sender: TObject);
  36.     procedure N2Click(Sender: TObject);
  37.     procedure N7Click(Sender: TObject);
  38.     procedure N8Click(Sender: TObject);
  39.     procedure N9Click(Sender: TObject);
  40.     procedure N10Click(Sender: TObject);
  41.     procedure N11Click(Sender: TObject);
  42.   private
  43.     { Private declarations }
  44.   public
  45.     { Public declarations }
  46.   end;
  47. var
  48.   papermadeform: Tpapermadeform;
  49.    fname:string;
  50. implementation
  51.    //  uses  Unit19;
  52. uses printers,Unit19, Unit10, Unit3, Unit4;
  53. {$R *.dfm}
  54. procedure Tpapermadeform.N22Click(Sender: TObject);
  55. begin
  56.  //  memo1.Clear;
  57. //if opendialog1.Execute then
  58. //begin
  59. //fname:=opendialog1.FileName;
  60. //memo1.Lines.LoadFromFile(fname);
  61. //editpaperform.Caption:=editpaperform.Caption+'['+fname+']';
  62. //end;
  63. end;
  64. procedure Tpapermadeform.N26Click(Sender: TObject);
  65. begin
  66.  close;
  67. end;
  68. procedure Tpapermadeform.U1Click(Sender: TObject);
  69. begin
  70. memo1.Undo;
  71. end;
  72. procedure Tpapermadeform.N12Click(Sender: TObject);
  73. begin
  74. memo1.CutToClipboard;
  75. end;
  76. procedure Tpapermadeform.N13Click(Sender: TObject);
  77. begin
  78. memo1.CopyToClipboard;
  79. end;
  80. procedure Tpapermadeform.N14Click(Sender: TObject);
  81. begin
  82. memo1.PasteFromClipboard;
  83. end;
  84. procedure Tpapermadeform.N16Click(Sender: TObject);
  85. begin
  86. memo1.SelectAll;
  87. //papermadeform.N14.Enabled:=true;
  88. //papermadeform.N13.Enabled:=true;
  89. end;
  90. procedure Tpapermadeform.N19Click(Sender: TObject);
  91. begin
  92. if fontdialog1.Execute then
  93. begin
  94. memo1.Font:=fontdialog1.Font;
  95. end;
  96. end;
  97. procedure Tpapermadeform.N24Click(Sender: TObject);
  98. //var
  99. //filename:string;
  100. begin
  101. //mainform.papertime:=mainform.papertime+1;
  102.   query1.Close;
  103.    query1.SQL.Clear;
  104.   // query1.SQL.text:='insert into papermanager values('''+inttostr(mainform.papertime)+''','''+definepaperform.DBEdit1.Text+''',''手动'','''+papermadeform.Memo1.Text+''','''+madeanswerform.Memo1.Text+''')'  ;
  105.     query1.SQL.text:='insert into papermanager values(:gg,''手动'',:ss,:dd)'  ;
  106. //   query1.ParamByName('nn').AsInteger:=mainform.papertime;
  107. query1.ParamByName('gg').AsString:=definepaperform.DBEdit1.Text;
  108.  query1.ParamByName('ss').AsString:=papermadeform.Memo1.Text ;
  109.  query1.ParamByName('dd').AsString:=madeanswerform.Memo1.Text ;
  110. //  query1.ParamByName('hh').AsInteger:=strtoint(definepaperform.DBEdit18.Text) ;
  111.    query1.ExecSQL;
  112.   //  mainform.papertime:=mainform.papertime+1;
  113. //savedialog1.Title:='保存生成后的试卷';
  114. //savedialog1.FileName:=fname;
  115. //if savedialog1.Execute then
  116.  //  begin
  117.   // filename:=savedialog1.FileName;
  118.  //  memo1.Lines.SaveToFile(filename+'.doc');
  119.  //  end;
  120.  DataModule4.Table_papermanager.Active:=false;
  121.    DataModule4.Table_papermanager.Active:=true;
  122. end;
  123. procedure Tpapermadeform.N1Click(Sender: TObject);
  124. begin
  125. madeanswerform.Show;
  126. end;
  127. procedure Tpapermadeform.N2Click(Sender: TObject);
  128. //var lines :integer;
  129.  //   prntext:system.text;
  130. begin
  131. Screen.Cursor:=crHourGlass;
  132.   try
  133.     print;
  134.     ShowMessage('打印完毕');
  135.   finally
  136.     Screen.Cursor:=crDefault;
  137.   end;
  138.   {
  139.     if printdialog1.Execute then
  140.     assignprn(prntext);
  141.     rewrite(prntext);
  142.     printer.canvas.Font:=memo1.font;
  143.     for lines:=0 to memo1.Lines.Count-1 do
  144.     begin
  145.     writeln(prntext,memo1.lines[lines]);
  146.     system.Close(prntext);
  147.     end;     }
  148. end;
  149. procedure Tpapermadeform.N7Click(Sender: TObject);
  150. begin
  151. memo1.Undo;
  152. end;
  153. procedure Tpapermadeform.N8Click(Sender: TObject);
  154. begin
  155. memo1.CutToClipboard;
  156. end;
  157. procedure Tpapermadeform.N9Click(Sender: TObject);
  158. begin
  159. memo1.CopyToClipboard;
  160. end;
  161. procedure Tpapermadeform.N10Click(Sender: TObject);
  162. begin
  163. Memo1.PasteFromClipboard;
  164. end;
  165. procedure Tpapermadeform.N11Click(Sender: TObject);
  166. begin
  167. memo1.SelectAll;
  168. papermadeform.N10.Enabled:=true;
  169. papermadeform.N9.Enabled:=true;
  170. end;
  171. end.
  172.