Пример #1
0
 public ImgMouseEventHandler(int columns, int rows, double w, double h)
 {
     ResetAttribute();
     _columns = columns;
     _rows    = rows;
     InitSizeItem(w, h);
     _ie = new ImgEventArgs();
 }
Пример #2
0
        private void ime_IEvent(object sender, ImgEventArgs iea)
        {
            if (_gameStart)
            {
                switch (iea.Event)
                {
                case EventList.LeftDown:
                    _mb.LeftDown(iea.X, iea.Y);
                    DrawGraphics();
                    break;

                case EventList.BothDown:
                    _mb.BothDown(iea.X, iea.Y);
                    DrawGraphics();
                    break;

                case EventList.LeftMove:
                    _mb.LeftMove(iea.X, iea.Y);
                    DrawGraphics();
                    break;

                case EventList.BothMove:
                    _mb.BothMove(iea.X, iea.Y);
                    DrawGraphics();
                    break;

                case EventList.LeftOut:
                    _mb.LeftOut(iea.X, iea.Y);
                    DrawGraphics();
                    break;

                case EventList.BothOut:
                    _mb.BothOut(iea.X, iea.Y);
                    DrawGraphics();
                    break;

                case EventList.LeftClick:
                    if (_enableTime == false)
                    {
                        _enableTime   = true;
                        timer.Enabled = true;
                        _mb.MakeMineMap(iea.Y * _appSettings.LatestColumns + iea.X);
                        _mb.LeftClick(iea.X, iea.Y);
                        DrawGraphics();
                    }
                    else
                    {
                        _mb.LeftClick(iea.X, iea.Y);
                        if (_mb.IsFinished)
                        {
                            _mb.Finished();
                        }
                        if (_mb.IsWin)
                        {
                            _mb.Win();
                        }
                        DrawGraphics();
                    }
                    break;

                case EventList.BothClick:
                    _mb.BothClick(iea.X, iea.Y);
                    if (_mb.IsFinished)
                    {
                        _mb.Finished();
                    }
                    if (_mb.IsWin)
                    {
                        _mb.Win();
                    }
                    DrawGraphics();
                    break;

                case EventList.RightClick:
                    _mb.RightClick(iea.X, iea.Y);
                    DrawGraphics();
                    break;
                }
            }
        }