Пример #1
0
        public frmCastSpell()
        {
            InitializeComponent();

            SetStyle( ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer | ControlStyles.ResizeRedraw
                | ControlStyles.UserPaint, true);

            _hero = null;
            _spells = new ArrayList();
            _currentPage = 0;

            _frmSpellInfo = null;

            _panelSpells = new Panel[]
            {
                this.panelSpell1, this.panelSpell2, this.panelSpell3, this.panelSpell4, this.panelSpell5, this.panelSpell6,
                this.panelSpell7, this.panelSpell8, this.panelSpell9, this.panelSpell10, this.panelSpell11, this.panelSpell12
            };

            _lblSpells = new Label[]
            {
                this.lblSpell1, this.lblSpell2, this.lblSpell3, this.lblSpell4, this.lblSpell5, this.lblSpell6,
                this.lblSpell7, this.lblSpell8, this.lblSpell9, this.lblSpell10, this.lblSpell11, this.lblSpell12
            };

            _lblNames = new Label[]
            {
                this.lblSpellName1, this.lblSpellName2, this.lblSpellName3, this.lblSpellName4, this.lblSpellName5, this.lblSpellName6,
                this.lblSpellName7, this.lblSpellName8, this.lblSpellName9, this.lblSpellName10, this.lblSpellName11, this.lblSpellName12
            };

            this.panelCancel.Click += new EventHandler(panelCancel_Click);

            foreach (Panel p in _panelSpells)
            {
                p.MouseClick += new MouseEventHandler(p_MouseClick);
                p.MouseDown += new MouseEventHandler(p_MouseDown);
                p.MouseUp += new MouseEventHandler(p_MouseUp);
            }
        }
Пример #2
0
 void p_MouseUp(object sender, MouseEventArgs e)
 {
     if (_frmSpellInfo != null)
     {
         _frmSpellInfo.Close();
         _frmSpellInfo.Dispose();
         _frmSpellInfo = null;
     }
 }
Пример #3
0
        void p_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                Panel p = (Panel)sender;

                int index = GetSpellIndex(p);
                if (index < 0) return;

                Spell spell = (Heroes.Core.Spell)_spells[index];

                _frmSpellInfo = new frmSpellInfo();
                _frmSpellInfo.StartPosition = FormStartPosition.Manual;

                Point pt = this.PointToScreen(new Point(e.X, e.Y));
                _frmSpellInfo.Location = pt;

                _frmSpellInfo.Show(this, spell);
            }
        }