Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ITT: My Mine Sweeper Project.
#15
DrRusty Wrote:well upload it somewhere so we can play it

Okay, just don't hold your breath for it.

And I'm stuck.

Code:
void MineButton_Click(Object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {                  
                bool found = false;
                for(int i = 1;i<y&&!found;++i)
                    for (int j = 1; j < x && !found; ++j)
                    {
                       [B] if (p[i,j].pic.Focus())[/B]
                        {   found = true;
                            if ((p[i,j].status == "Cover")|(p[i,j].status == "Marked"))
                            {
                                if (!began)
                                { PlaceMine(i,j); }
                            }
                        }
                    }
            }
...

I'm trying to make it detect which picturebox is it clicking. I tried .Focus(), it reacts only to top left button, first one that is initialized. I also tried to get cursor's location and react to button at its location. But it returns cursor's location ON each button instead. Each button has 15 px height and width, and when I ask for cursor's location, I get only number under 15 no matter where I click.

tldr; I want to detect which picturebox it's clicking. What should I replace in that bold line?
Reply


Messages In This Thread
ITT: My Mine Sweeper Project. - by Spaz - 2010-12-29, 10:39 PM
ITT: My Mine Sweeper Project. - by Spaz - 2010-12-30, 06:44 PM
ITT: My Mine Sweeper Project. - by Spaz - 2011-01-01, 10:28 PM
ITT: My Mine Sweeper Project. - by Spaz - 2011-01-02, 07:17 PM
ITT: My Mine Sweeper Project. - by DrRusty - 2011-01-05, 10:06 AM
ITT: My Mine Sweeper Project. - by DrRusty - 2011-01-05, 11:15 AM
ITT: My Mine Sweeper Project. - by Unauthorized Intruder - 2011-01-05, 12:08 PM
ITT: My Mine Sweeper Project. - by Spaz - 2011-01-05, 04:00 PM
ITT: My Mine Sweeper Project. - by Spaz - 2011-01-06, 05:07 PM
ITT: My Mine Sweeper Project. - by Spaz - 2011-01-07, 03:10 PM
ITT: My Mine Sweeper Project. - by Spaz - 2011-01-13, 03:27 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)