예제 #1
0
        /// <summary>
        /// 后退到
        /// </summary>
        /// <param name="Value"></param>
        public async Task SetBackToValue(int Value)
        {
            await Task.Factory.StartNew(new Action(() =>
            {
                while (Value < _iValue)
                {
                    CusPicToPb.Invoke(new Action(() =>
                    {
                        g = Graphics.FromImage(bmp);

                        g.FillRectangle(new SolidBrush(Color.Gray), new Rectangle((int)((_iValue) * _iUnit), 0, (int)_iUnit, _iHeight));

                        CusPicToPb.Image = bmp;
                    }));

                    _iValue--;
                }
                if (Value == 0)
                {
                    CusPicToPb.Invoke(new Action(() =>
                    {
                        g = Graphics.FromImage(bmp);

                        g.FillRectangle(new SolidBrush(Color.Gray), new Rectangle(0, 0, CusPicToPb.Width, CusPicToPb.Height));

                        CusPicToPb.Image = bmp;
                    }));
                }
            }));
        }
예제 #2
0
        /// <summary>
        /// 前进到
        /// </summary>
        /// <param name="Value"></param>
        public async Task SetForwardToValue(int Value)
        {
            await Task.Factory.StartNew(new Action(() =>
            {
                while (Value > _iValue)
                {
                    CusPicToPb.Invoke(new Action(() =>
                    {
                        g = Graphics.FromImage(bmp);

                        g.FillRectangle(new SolidBrush(Color.Orange), new Rectangle(0, 0, (int)(_iValue * _iUnit), _iHeight));

                        CusPicToPb.Image = bmp;
                    }));

                    _iValue++;
                }
                if (Value == 100)
                {
                    CusPicToPb.Invoke(new Action(() =>
                    {
                        g = Graphics.FromImage(bmp);

                        g.FillRectangle(new SolidBrush(Color.Orange), new Rectangle(0, 0, this.Width, this.Height));

                        CusPicToPb.Image = bmp;
                    }));
                }
            }));
        }