TShiftState(10分)

  • 主题发起人 主题发起人 cpjin
  • 开始时间 开始时间
C

cpjin

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.DBGridEh1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if (Button =mbright )and(Shift=up)and ( query_jbqk.RecordCount>0) then //
begin
dbgrideh1.BeginDrag(false);
form1.PopupMenu4.Items.Items[0].Caption:=' '+query_jbqk.fieldbyname('xingming').asstring;

edit1.Text:=query_jbqk.fieldbyname('xingming').asstring;
end;
end;

end.

其中Shift: TShiftState 的取值有那几种?? 我的帮助文件坏了,每办法查
 
ssShift The Shift key is held down.
 
ssShift The Shift key is held down.
ssAlt The Alt key is held down.
ssCtrl The Ctrl key is held down.
ssLeft The left mouse button is held down.
ssRight The right mouse button is held down.
ssMiddle The middle mouse button is held down.
ssDouble The mouse was double-clicked.
 
按住ctrl,用鼠标点它,你会看到:
TShiftState = set of (ssShift, ssAlt, ssCtrl,
ssLeft, ssRight, ssMiddle, ssDouble);
 
//我的帮助文件坏了,每办法查
那还不简单,按住 Ctrl 键不放,点击 TShiftState 就会跳转到它的定义部分,
直接看源代码,多方便?
我遇到问题时,这是首先使用的方法,其次才是看帮助:)
 
procedure TForm1.DBGridEh1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if (Button =mbright )and(Shift=ssCtrl)and ( query_jbqk.RecordCount>0) then //
begin
dbgrideh1.BeginDrag(false);
form1.PopupMenu4.Items.Items[0].Caption:=' '+query_jbqk.fieldbyname('xingming').asstring;

edit1.Text:=query_jbqk.fieldbyname('xingming').asstring;
end;
end;

end.
这样做怎么编译出错?? Shift=ssCtrl本身不会错吧??
 
注意set是集合呀。
if (ssCtrl in Shift) then ...
 
非常感谢,我和你们学了几招,特别是beta (:
 

Similar threads

后退
顶部