I try to find an event for if you rightclick and leftclick a buttoncontrol in a Form application. Simply, to detect if it is the left or right button on the mouse that is clicked.
What I want to do is that if I rightclick a button I want the button to change backcolor to Red and when I Leftclick the button I want the button to change backColor to Blue.
The only event I can find is "MouseClick".
Is this possible to use in any way to further detect if it is left or rightclick ?
I donĀ“t get the below to work. What could be wrong here ?
CompileError:
could not deduce template argument for 'const std::vector<_Ty,_Alloc> &' from 'System::Windows::Forms::MouseButtons'
RightClickEvent:
private: System::Void button5_MouseDown(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e)
{
if( e->Button == Buttons::Right)
{
button1->BackColor = Color::Red;
}
}
LeftClickEvent:
private: System::Void button5_MouseDown(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e)
{
if( e->Button == Buttons::Left)
{
button1->BackColor = Color::Blue;
}
}