我有StringGrid,并希望在它的细胞只有1
或0
。我尝试使用StringGridGetEditMask德尔福掩码的二进制数
procedure TForm1.StringGrid1GetEditMask(Sender: TObject; ACol,
ARow: Integer; var Value: String);
begin
Value := '0';
if not (strToInt(Value) in [0,1]) then value := #0;
end;
但我可以输入从0到9的所有数字我怎么能过滤所有的数字,除0和1?
我没有得到您的代码。如果将值“0”赋值给“Value”,那么当然'StrToInt(Value)'将等于'0'? – 2013-03-26 19:38:43
我将值转换为整数并与0和1进行比较。如果值不是0或不是1,则值将等于空字符。 – Vlad 2013-03-26 19:45:38