How to determine whether the left mouse button or right button is pressed in the onmousedown event
Source: Internet
Author: User
For example, in the onmousedown, there is a parameter is button, he represents the mouse button is caused by the event, while the shift shows the state of the keys at this time (not only the left button, right button, and Alt,ctrl keyboard keys, Specifically, you can see the definition of tshiftstate, in CLASSES.HPP).
The code is as follows, if L is displayed, the left button is pressed, the R is displayed, the right button is pressed and all the display is pressed.
void __fastcall Tform1::formmousedown (tobject *sender, Tmousebutton Button,
Tshiftstate Shift, int X, int Y)
{
Ansistring sbuttonstate;
if (Shift.contains (Ssleft))
{
Sbuttonstate + = "L";
}
if (Shift.contains (ssright))
{
Sbuttonstate + = "R";
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.