MouseEventArgs unidentified problem

so, i'm developing a game for my programming class in college. there's a fragment of my code that keeps getting an error although there is no error identified by Visual Studio. i'll paste the part of the code i'm having trouble with in hope someone on this forum knows what i can do to fix it.

private: String^JugarCartaAlumno(int i, System::Windows::Forms::MouseEventArgs^ e){
if (e->Button == ::MouseButtons::Left){
Batalla->jugarCartaAlumno(i, true);
return gcnew String("Ataque");
}
else if (e->Button == ::MouseButtons::Right){
Batalla->jugarCartaAlumno(i, false);
return gcnew String("Defensa");
}
}

the code is in spanish since my mother languaje is spanish but i think it is easy to understand what the problem is. the error i keep getting are

Error 62 error C3083: 'MouseButtons': the symbol to the left of a '::' must be a type

Error 63 error C2039: 'Left' : is not a member of '`global namespace''

Error 64 error C2678: binary '==' : no operator found which takes a left-hand operand of type 'System::Windows::Forms::MouseButtons' (or there is no acceptable conversion)

Error 65 error C3083: 'MouseButtons': the symbol to the left of a '::' must be a type

Error 66 error C2039: 'Right' : is not a member of '`global namespace''

Error 67 error C2678: binary '==' : no operator found which takes a left-hand operand of type 'System::Windows::Forms::MouseButtons' (or there is no acceptable conversion)

and the list goes on with the same errors for each switch case.

Last edited on
MouseButton is an enumeration, so you call it like this: System::Windows::Forms::MouseButton::Left.
1
2
3
4
5
6
7
8
9
10
11
12
13
private: String^JugarCartaAlumno(int i, System::Windows::Forms::MouseEventArgs^ e)
{
   if (e->Button == System::Windows::Forms::MouseButtons::Left)
  {
      Batalla->jugarCartaAlumno(i, true);
      return gcnew String("Ataque");
  }
  else if (e->Button == System::Windows::Forms::MouseButtons::Right)
  {
      Batalla->jugarCartaAlumno(i, false);
      return gcnew String("Defensa");
  }
}
thank you so much thomas, i knew the solution was something like that although i didn't knew how to write it. again, thank you.
Topic archived. No new replies allowed.