delphi 中 键盘操作..检测功能键是否按下,TShiftState类 为什么判断时候 要用 >=

例如 if shift >= [ssShift ] then xxxxxxx
2026年09月10日 07:48
有2个网友回答
网友(1):

定义:TShiftState = set of (ssShift, ssAlt, ssCtrl, ssLeft, ssRight, ssMiddle, ssDouble)
看set的帮助:X <= Y is True just in case every member of X is a member of Y; Z >= W is equivalent to W <= Z. U = V is True just in case U and V contain exactly the same members; otherwise, U <> V is True.
也就是说set的>=操作其实就相当于in操作。

网友(2):

shift 是集合,不是这样做的。
if (Shift = [ssShift ]) then