Ejemplo n.º 1
0
        private void OnPaint(PaintEventArgs e, bool cashedPaint)
        {
            SmoothingMode sm = e.Graphics.SmoothingMode;
            TextRenderingHint th = e.Graphics.TextRenderingHint;

            if (this.BackColor.IsEmpty || this.BackColor == Color.Transparent)
            {
                base.OnPaintBackground(e);
            }

            if (m_BackgroundStyle != null)
                m_BackgroundStyle.SetColorScheme(this.GetColorScheme());

            ItemPaintArgs pa = GetItemPaintArgs(e.Graphics);
            pa.PaintEventArgs = e;
            pa.ClipRectangle = e.ClipRectangle;
            if (_CanAnimate)
            {
                pa.AnimationEnabled = true;
                pa.AnimationRequests = new System.Collections.Generic.List<DevComponents.DotNetBar.Animation.AnimationRequest>();
            }
            if (m_FirstScrollPaint && this.AutoScroll && this.Controls.Count > 0)
            {
                pa.ClipRectangle = Rectangle.Empty;
                m_FirstScrollPaint = false;
            }
            pa.CachedPaint = cashedPaint;
            PaintControl(pa);

            e.Graphics.SmoothingMode = sm;
            e.Graphics.TextRenderingHint = th;

            // Kick off animations if needed
            if (pa.AnimationEnabled && pa.AnimationRequests.Count > 0)
            {
                Animation.AnimationRectangle anim = new DevComponents.DotNetBar.Animation.AnimationRectangle(pa.AnimationRequests.ToArray(),
                    Animation.AnimationEasing.EaseOutExpo, 500);
                anim.AnimationUpdateControl = this;
                _CanAnimate = false;
                anim.AnimationCompleted += AnimationCompleted;
                anim.Start();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Slides panel out of the view.
        /// </summary>
        private void SlideOutOfView()
        {
            Animation.Animation current = _CurrentAnimation;
            if (current != null)
            {
                current.Stop();
                WaitForCurrentAnimationFinish();
            }
            
            Rectangle bounds = this.Bounds;
            Rectangle targetBounds = GetSlideOutBounds();

            if (_AnimationTime > 0 && this.Visible)
            {
                _IsAnimating = true;
                //BarFunctions.AnimateControl(this, true, _AnimationTime, bounds, targetBounds);
                Animation.AnimationRectangle anim = new DevComponents.DotNetBar.Animation.AnimationRectangle(
                    new Animation.AnimationRequest(this, "Bounds", bounds, targetBounds),
                    Animation.AnimationEasing.EaseOutExpo, _AnimationTime);
                anim.AnimationCompleted += new EventHandler(AnimationCompleted);
                anim.Start();
                _CurrentAnimation = anim;
                //this.Visible = false;
            }
            else
                this.Bounds = targetBounds;
            _OpenBounds = bounds;

            if (_SlideOutButtonVisible)
                CreateSlideOutButton();
        }