发信人: t_venus(独孤老人)
整理人: soaringbird(2002-02-07 10:43:59), 站内信件
|
【 在 yunwilson 的大作中提到:】
:各位高手:
: 请教如何判断edit输入的是数字和小数点?,并在Edit中使数字右对齐.
:......
1、过滤掉其他字符的方法:
TForm1.Edit1OnKeyPress((Sender: TObject; var Key: Char);
begin
if ((Key>'9') OR (Key<'0')) AND (Key<>'.') then
Key :=0;
end;
2、默认右对齐
MSDN 中介绍 EDIT 控件如果是单行的,就不能右对齐:
ES_LEFT, ES_RIGHT, and ES_CENTER specify the alignment the text in an edit control should have. Single-line edit controls can only be left-aligned.
绕过的办法是用 TMemo,设置它的 Alignment 为 taRightJustify,
同时 WantReturn 为 FALSE 就行了。
---- 昨天没死
就是说今天我还活着 |
|