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);
很抱歉,提供的代码段并不能完全说明图片上的错误。请提供更多关于错误的信息,例如错误消息或代码的上下文等。只有在获得更多信息后,我们才能更准确地判断和解决该错误。