I have a panel called panel1.

What I wonder how it is possible to do is that when you click the mouse on the location 304,369 in the panel, I want to display a messageBox.

How would that be possible to identify the location in code ?

private: System::Void panel1_MouseDown(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) 
{

if( ??? )
{
    MessageBox::Show("You clicked Location 304,369 in the panel  
                                      with the mouse !");

}

}

You get where the click came from via the e parameter. e->X gives you the x coordinate and e->Y the y. It's going to be tricky to get your user to grab the exact point I think, you may want to use a (small) range.

Edited 6 Years Ago by jonsca: C# hat on

I understand, I did set an area where the user can press as you said... that worked fine:

private: System::Void panel1_MouseDown(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) 
{
	 if( e->X >= 304 && e->X <= 346 && e->Y >= 369 && e->Y <= 392 )
	 {
		 MessageBox::Show("Clicked Area");
	 }
}

Thank you...

This question has already been answered. Start a new discussion instead.