摘要: procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);begin case Key of '0'..'9', #8, #13, #27, '.' : ; else begin MessageBox(Handle, '请输入数字', PChar('输入错误'), MB_OK + MB_ICONINFORMATION); Key := #0; end; end;end;//只能输入数字和小数点,//只需要编写edit1的KeyPress事件,edi 阅读全文
posted @ 2011-03-01 20:48 吴越 阅读(158) 评论(0) 推荐(0) 编辑
摘要: Delphi的实数计算结果中如何只保留2位小数━━━━━━━━━━━━━━━━━━━━━━━━━━你可以使用这样的办法: x := Round(x * 100) / 100; 高峰、空中人的意见: 在USER部份加入MATH单元后可以使用 x:=RoundTo(y, 2) 郑茂强的意见: 我是用这个办法的: x=a/b; x=strtofloat(formatfloat('0.00',x)); 阅读全文
posted @ 2011-03-01 20:38 吴越 阅读(3630) 评论(0) 推荐(0) 编辑
摘要: if (Edit1.Text='')or(Edit2.Text='') then... 阅读全文
posted @ 2011-03-01 20:36 吴越 阅读(277) 评论(0) 推荐(0) 编辑