コード例 #1
0
        private void changeButton_MouseEnter(object sender, EventArgs e)
        {
            int y = 0;

            if (ChangeSimulate != null)
            {
                _drawnCoins = ChangeSimulate();
                foreach (Component c in descriptionToolTips.Container.Components)
                {
                    if (c is CoinsBar)
                    {
                        CoinsBar cb = c as CoinsBar;
                        CoinType i  = (CoinType)cb.CoinValue;
                        if (cb.Visible = _drawnCoins.Keys.Contains(i))
                        {
                            cb.Top   = y++ *36 + 8;
                            cb.Value = _drawnCoins[i] > cb.Maximum ? cb.Maximum : _drawnCoins[i];
                        }
                    }
                }
            }
            if (_drawn = y > 0)
            {
                if (y++ > 2)
                {
                    y *= 2;
                }
                else
                {
                    y += --y;
                }
                descriptionToolTips.RemoveAll();
                descriptionToolTips.SetToolTip(changeButton, string.Join("\n", (string[])Array.CreateInstance(typeof(string), y)) + "                                        ");
            }
        }
コード例 #2
0
 private void coins_MouseMove(object sender, MouseEventArgs e)
 {
     if (_notClick)
     {
         _notClick = false;
         CoinsBar s = sender as CoinsBar;
         s.DoDragDrop(s.CoinValue, DragDropEffects.Move | DragDropEffects.Link);
     }
 }
コード例 #3
0
        private void coins_MouseDown(object sender, MouseEventArgs e)
        {
            CoinsBar s = sender as CoinsBar;

            if (_hitTestPass = (e.Location.X - 15 <= s.Value * (s.Width - 14) / (s.Maximum - s.Minimum)))
            {
                _notClick = true;
            }
        }
コード例 #4
0
        public void SetControlType(AccountType type)
        {
            switch (_controlType = type)
            {
            case AccountType.Customer:
                coinsInfo1.Visible  = true;
                coinsInfo2.Visible  = true;
                coinsInfo5.Visible  = true;
                coinsInfo10.Visible = true;
                coins1.Visible      = true;
                coins2.Visible      = true;
                coins5.Visible      = true;
                coins10.Visible     = true;
                groupBox1.Visible   = true;
                break;

            case AccountType.VendingMachine:
                coinsInfoVM1.Visible       = true;
                coinsInfoVM2.Visible       = true;
                coinsInfoVM5.Visible       = true;
                coinsInfoVM10.Visible      = true;
                coinsVM1.Visible           = true;
                coinsVM2.Visible           = true;
                coinsVM5.Visible           = true;
                coinsVM10.Visible          = true;
                changeButton.Visible       = true;
                descriptionToolTips.Active = true;
                int y = 0;
                foreach (CoinType i in new List <CoinType> {
                    CoinType.coin1, CoinType.coin2, CoinType.coin5, CoinType.coin10
                })
                {
                    CoinsBar cb = new CoinsBar()
                    {
                        Left = 8, Top = y++ *36 + 8, Width = 100, Height = 30, Minimum = 0, Maximum = 10, BackColor = Color.Gold, ForeColor = Color.Chocolate, CoinValue = (int)i, Value = 0, Visible = false
                    };
                    cb.SetControlType(AccountType.Customer);
                    descriptionToolTips.Container.Add(cb);
                }
                descriptionToolTips.SetToolTip(changeButton, " ");
                break;
            }
        }
コード例 #5
0
        private void descriptionToolTips_Draw(object sender, DrawToolTipEventArgs e)
        {
            e.DrawBackground();
            Rectangle rect = e.Bounds;
            Bitmap    bmp  = new Bitmap(ResourceLoadHelper.GetBlankImage(new Size(rect.Width, rect.Height), descriptionToolTips.BackColor));

            foreach (Component c in descriptionToolTips.Container.Components)
            {
                if (c is CoinsBar)
                {
                    CoinsBar cb = c as CoinsBar;
                    if (cb.Visible)
                    {
                        rect = cb.Bounds;
                        cb.DrawToBitmap(bmp, rect);
                        e.Graphics.DrawImage(bmp, rect, rect, GraphicsUnit.Pixel);
                        e.Graphics.DrawString(string.Format("x{0}", _drawnCoins[(CoinType)cb.CoinValue]), new Font("Microsoft Sans Serif", 7, FontStyle.Italic), new SolidBrush(Color.Black), rect.Right, rect.Bottom - 14);
                    }
                }
            }
            e.DrawBorder();
        }