示例#1
0
        protected override void OnPaint(PaintEventArgs e)
        {
            Rectangle rec = new Rectangle(0, 0, this.Width, this.Height);

            GraphicsPathHelper.Draw(rec, e.Graphics, radius, false, BackColor);
            base.OnPaint(e);
            Graphics g = e.Graphics;

            if (_animationManager.IsAnimating())
            {
                g.SmoothingMode = SmoothingMode.AntiAlias;
                Color bg = BackColor.TakeBackColor();//取相反色
                using (SolidBrush hrush = new SolidBrush(Color.FromArgb(50, bg)))
                {
                    float      animationValue = (float)_animationManager.GetProgress();
                    float      x    = _animationManager.GetMouseDown().X - animationValue / 2;
                    float      y    = _animationManager.GetMouseDown().Y - animationValue / 2;
                    RectangleF rect = new RectangleF(x, y, animationValue, animationValue);
                    g.FillEllipse(hrush, rect);
                }
                g.SmoothingMode = SmoothingMode.None;
            }

            DrawImage(e.Graphics);
            DrawText(e.Graphics);
        }
示例#2
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            if (m_Path == null)
            {
                return;
            }
            Graphics g = e.Graphics;

            g.SmoothingMode = SmoothingMode.AntiAlias;
            using (SolidBrush solidBrush = new SolidBrush(BackColor))
            {
                g.FillPath(solidBrush, m_Path);
            }

            if (_animationManager.IsAnimating())
            {
                //g.SmoothingMode = SmoothingMode.AntiAlias;
                Color bg = BackColor.TakeBackColor();//取相反色
                using (SolidBrush hrush = new SolidBrush(Color.FromArgb(50, bg)))
                {
                    float      animationValue = (float)_animationManager.GetProgress();
                    float      x    = _animationManager.GetMouseDown().X - animationValue / 2;
                    float      y    = _animationManager.GetMouseDown().Y - animationValue / 2;
                    RectangleF rect = new RectangleF(x, y, animationValue, animationValue);
                    g.FillEllipse(hrush, rect);
                }
                //g.SmoothingMode = SmoothingMode.None;
            }

            DrawImage(g);
            DrawText(g);
        }
示例#3
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            if (Adapter == null)
            {
                return;
            }
            VirtualHeight = 0;
            VirtualWidth  = 0;


            if (_animationManager.IsAnimating() && _clickViewHolder != null)
            {
                e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
                Color bg = BackColor.TakeBackColor();//取相反色
                using (SolidBrush hrush = new SolidBrush(Color.FromArgb(50, bg)))
                {
                    float      animationValue = (float)_animationManager.GetProgress();
                    float      x    = _animationManager.GetMouseDown().X - animationValue / 2;
                    float      y    = _animationManager.GetMouseDown().Y - animationValue / 2;
                    RectangleF rect = new RectangleF(x, y, animationValue, animationValue);
                    e.Graphics.FillEllipse(hrush, rect);
                }
                e.Graphics.SmoothingMode = SmoothingMode.Default;
            }

            int count = Adapter.GetItemCount();

            for (int i = 0; i < count; i++)
            {
                ViewHolder viewHolder = Adapter.OnCreateViewHolder(this, -_vScroll.Value, i);
                VirtualHeight += viewHolder.Bounds.Height;
                VirtualWidth  += viewHolder.Bounds.Width;

                if (viewHolder.Bounds.Bottom >= 0 && viewHolder.Bounds.Y <= this.Height)
                {
                    Adapter.OnDrawItem(e.Graphics, viewHolder, i);
                }
            }

            _vScroll.VirtualHeight = VirtualHeight;  //绘制完成计算虚拟高度决定是否绘制滚动条
            if (_MouseVisible && _vScroll.Visible)   //是否绘制滚动条
            {
                _vScroll.ReDrawScroll(e.Graphics);
            }
        }