Hi
i am making a chess game as a project in my OOP course. so the first thing to start with will be to get the coordinates of the form where i click on it. it will help me a lot to start making the movement functions coz i would have the coordinates of the point from where i'll pick up any piece and to the place where i wannna put it.
anyone who knows how to do this please help!
Wanna get the coordinates where i click on the form
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
AnttiRank #9,295 · 208 pointsPosted Jan 1, 2006, 12:10 PM EST
Raheel Imtiaz5 pointsPosted Jan 3, 2006, 8:09 AM EST
Matt Speller14 pointsPosted Jan 3, 2006, 11:05 PM EST
The event you need is the mousedown event. It is very simple to set this up. I will show you the code that is needed in case you need it:-
in the constructor/initialise component:-
this.MouseDown+=new MouseEventHandler(Form1_MouseDown);
and the event handler
private void Form1_MouseDown(object sender, MouseEventArgs e)
{