同时捕获多个按键

QsLrEn 2008-03-11 02:37:37
在捕获1个按键只要在keydown事件中根据key值来判断就可以了,但是现在要捕获Alt+1,或者多个按键同时按下的消息,应该怎么判断捕获
...全文
139 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
11113fsfasdfasdfa 2008-03-12
  • 打赏
  • 举报
回复
学习了
wmfbravo 2008-03-12
  • 打赏
  • 举报
回复
void __fastcall TForm1::FormKeyDown(TObject *Sender, WORD &Key,
TShiftState Shift)
{
//组合键可以通过Shift参数来判断
if(Shift.Contains(ssAlt) && Key==65)
{
ShowMessage("Alt+A");
}
}
//---------------------------------------------------------------------------
我不懂电脑 2008-03-11
  • 打赏
  • 举报
回复
Shift判断组合键的。
QsLrEn 2008-03-11
  • 打赏
  • 举报
回复
谢谢 不过没有分送
i_love_pc 2008-03-11
  • 打赏
  • 举报
回复
void __fastcall TForm1::FormKeyDown(TObject *Sender, WORD &Key,
TShiftState Shift)
{
//组合键可以通过Shift参数来判断
TShiftState tss;
if(Shift== tss<<ssAlt && Key==65)
{
ShowMessage("Alt+A");
}
}
//---------------------------------------------------------------------------
QsLrEn 2008-03-11
  • 打赏
  • 举报
回复
void __fastcall TForm1::FormKeyDown(TObject *Sender, WORD &Key,
TShiftState Shift)
{
//组合键可以通过Shift参数来判断
}
我就是这个Shift参数不知道怎么写呀
i_love_pc 2008-03-11
  • 打赏
  • 举报
回复
TShiftState indicates the state of the Alt, Ctrl, and Shift keys and the mouse buttons.

Unit

Classes

typedef Set<Classes__1, ssShift, ssDouble> TShiftState;

Description

The TShiftState type is used by key-event and mouse-event handlers to determine the state of the Alt, Ctrl, and Shift keys and the state of the mouse buttons when the event occurs. It is a set of flags that indicate the following:

Value Meaning

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.
i_love_pc 2008-03-11
  • 打赏
  • 举报
回复
void __fastcall TForm1::FormKeyDown(TObject *Sender, WORD &Key,
TShiftState Shift)
{
//组合键可以通过Shift参数来判断
}
//---------------------------------------------------------------------------

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧