如何检查在 c++/cli 中的 MouseClick 事件期间单击了哪个鼠标按钮?
它应该在 C# 中像这样工作,但是在 C++/cli 中等效的是什么?
private void CustomControl_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
... do something
}
}
MouseButtons.Right、MouseButtons::Right 和 MouseButtons->Right 似乎都无法编译。它总是说
error C2039: 'Right' : is not a member of 'System::Enum'
这是我的 c++/cli 代码:
System::Void WindowTest::pictureBoxTest_MouseClick(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e)
{
if (e->Button == MouseButtons::Left)
{
// do something
}
}
It's supposed to work like this in c#, but what's the equivalent in c++/cli?
private void CustomControl_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
... do something
}
}
MouseButtons.Right, MouseButtons::Right and MouseButtons->Right all don't seem to compile. It always says
error C2039: 'Right' : is not a member of 'System::Enum'
Here is my c++/cli code:
System::Void WindowTest::pictureBoxTest_MouseClick(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e)
{
if (e->Button == MouseButtons::Left)
{
// do something
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从 此处 您似乎缺少 < code>:: 在
MouseButtons::Right
之前From here you seem to be missing the
::
before yourMouseButtons::Right