十三香傻瓜 2021-06-29 22:23 采纳率: 0%
浏览 14

Delphi7 每次都是图片上的问题实在不会弄了

procedure TMainForm.Edit2KeyPress(Sender: TObject; var Key: Char); var x: single; s: string; begin if not (Key in ['0'..'9', #8, #13]) then begin Key := #0; ShowMessage('只能输入数字'); end; begin if (key = #13) then begin if Edit1.Text = format('%3d+%3d=',[a,b]) then Eor.EorForm.Label2.Caption:=inttostr(strtoint(Eor.EorForm.Label2.Caption)+1); if Edit1.Text = format('%3d-%3d=',[a,b]) then Eor.EorForm.Label4.Caption:=inttostr(strtoint(Eor.EorForm.Label4.caption)+1); if Edit1.Text = format('%3d*%3d=',[c,d]) then Eor.EorForm.Label6.Caption:=inttostr(strtoint(Eor.EorForm.Label6.Caption)+1); if Edit1.Text = format('%3d/%3d=',[e,d]) then Eor.EorForm.Label8.Caption:=inttostr(strtoint(Eor.EorForm.Label8.Caption)+1); MainForm.Tag:=MainForm.Tag + 1; if StrToInt(Edit2.Text) = Edit1.Tag then begin if Edit1.Text = format('%3d+%3d=',[a,b]) then Eor.EorForm.Label1.Caption:=inttostr(strtoint(Eor.EorForm.Label1.Caption)+1); if Edit1.Text = format('%3d-%3d=',[a,b]) then Eor.EorForm.Label3.Caption:=inttostr(strtoint(Eor.EorForm.Label3.Caption)+1); if Edit1.Text = format('%3d*%3d=',[c,d]) then Eor.EorForm.Label5.Caption:=inttostr(strtoint(Eor.EorForm.Label5.Caption)+1); if Edit1.Text = format('%3d/%3d=',[e,d]) then Eor.EorForm.Label7.Caption:=inttostr(strtoint(Eor.EorForm.Label7.Caption)+1);

  ListBox1.Items.Insert(0,format(Edit1.Text+'%3s √',[Edit2.Text]));
  ListBox1.Tag := ListBox1.Tag + 1;

  ADOQuery1.SQL.Clear;
  ADOQuery1.Close;
  ADOQuery1.SQL.Clear;
  ADOQuery1.SQL.Add('Insert Into record(userid,question,youranswer,rightanswer,result,time)');
  ADOQuery1.SQL.Add('Values(:aa,:bb,:cc,:dd,:ee,:ff)');

  ADOQuery1.Parameters.ParamByName('aa').Value:=login.LoginForm.Edit1.Text;
  ADOQuery1.Parameters.ParamByName('bb').Value:=Edit1.Text;
  ADOQuery1.Parameters.ParamByName('cc').Value:=StrToInt(Edit2.Text);
  ADOQuery1.Parameters.ParamByName('dd').Value:=Edit1.Tag;
  ADOQuery1.Parameters.ParamByName('ee').Value:='正确';
  ADOQuery1.Parameters.ParamByName('ff').Value:=FormatDateTime('yyyy年mm月dd日 hh时nn分ss秒',now());
  ADOQuery1.ExecSQL;

  ADOQuery2.SQL.Add('select * from record where userid=:aa ');
  ADOQuery2.Parameters.ParamByName('aa').Value:=login.LoginForm.Edit1.Text;

  ADOQuery2.Open;
end
else
begin
  ListBox1.Items.Insert(0,Edit1.Text+Edit2.Text+'   ×');
  ADOQuery1.SQL.Clear;
  ADOQuery1.Close;
  ADOQuery1.SQL.Clear;
  ADOQuery1.SQL.Add('Insert Into record(userid,question,youranswer,rightanswer,result,time)');
  ADOQuery1.SQL.Add('Values(:aa,:bb,:cc,:dd,:ee,:ff)');

  ADOQuery1.Parameters.ParamByName('aa').Value:=login.LoginForm.Edit1.Text;
  ADOQuery1.Parameters.ParamByName('bb').Value:=Edit1.Text;
  ADOQuery1.Parameters.ParamByName('cc').Value:=StrToInt(Edit2.Text);
  ADOQuery1.Parameters.ParamByName('dd').Value:=Edit1.Tag;
  ADOQuery1.Parameters.ParamByName('ee').Value:='错误';
  ADOQuery1.Parameters.ParamByName('ff').Value:=FormatDateTime('yyyy年mm月dd日 hh时nn分ss秒',now());
  ADOQuery1.ExecSQL;


  ADOQuery2.SQL.Add('select * from record where userid=:aa ');
  ADOQuery2.Parameters.ParamByName('aa').Value:=login.LoginForm.Edit1.Text;

  ADOQuery2.Open;

  if edit1.Text=format('%3d+%3d=',[a,b]) then
    Series1.Add(a,'加法错误率',clgreen);
  if edit1.Text=format('%3d-%3d=',[a,b]) then
    Series1.Add(a,'减法错误率',clgreen);
  if edit1.Text=format('%3d*%3d=',[c,d]) then
    Series1.Add(a,'乘法错误率',clgreen);
  if edit1.Text=format('%3d/%3d=',[e,d]) then
    Series1.Add(a,'除法错误率',clgreen);
end;
MainForm.FormActivate(sender);
x := ListBox1.Tag *100/(MainForm.Tag);
s := #13 + '共做%d题'+#13+#13+#13+ '正确率为: '+#13+#13+'%f%%';
Label1.Caption := format(s,[MainForm.Tag,x]);

end; end; end;

img

  • 写回答

1条回答 默认 最新

  • 关注

    图片是保存在数据库里面吗?还是只保存了图片地址呢?

    评论

报告相同问题?

悬赏问题

  • ¥15 python:excel数据写入多个对应word文档
  • ¥60 全一数分解素因子和素数循环节位数
  • ¥15 ffmpeg如何安装到虚拟环境
  • ¥188 寻找能做王者评分提取的
  • ¥15 matlab用simulink求解一个二阶微分方程,要求截图
  • ¥30 乘子法解约束最优化问题的matlab代码文件,最好有matlab代码文件
  • ¥15 写论文,需要数据支撑
  • ¥15 identifier of an instance of 类 was altered from xx to xx错误
  • ¥100 反编译微信小游戏求指导
  • ¥15 docker模式webrtc-streamer 无法播放公网rtsp