Пример #1
0
        public override void Dispose()
        {
            try
            {
                // TODO: dispose of your content here
                capturedTexture.Dispose();
                renderTarget.Dispose();

                if (multiline)
                {
                    if (vscrollbar != null)
                    {
                        vscrollbar.Dispose();
                    }
                    if (hscrollbar != null)
                    {
                        hscrollbar.Dispose();
                    }
                }

                texture.Dispose();
                spriteBatch.Dispose();

                base.Dispose();
            }
            catch (Exception)
            {
            }
        }
Пример #2
0
        private void InitScrollbars(ContentManager content, GraphicsDevice graphics)
        {
            if (vscrollbar != null && !vscrollbar.IsDisposed)
            {
                vscrollbar.Dispose();
            }
            if (hscrollbar != null && !hscrollbar.IsDisposed)
            {
                hscrollbar.Dispose();
            }

            #region initialize Horizontal scrollbar
            if (HorizontalScrollbar)
            {
                if (items.Count > visibleItems)
                {
                    hscrollbar = new Scrollbar("hscrollbar", Position + new Vector2(1, Height - 13), Scrollbar.Type.Horizontal, (int)Width - 14);
                }
                else
                {
                    hscrollbar = new Scrollbar("hscrollbar", Position + new Vector2(1, Height - 13), Scrollbar.Type.Horizontal, (int)Width - 2);
                }

                hscrollbar.Owner = this.Owner;
                hscrollbar.Initialize(content, graphics);
            }
            #endregion

            int vScrollbarHeight = 0;
            if (HorizontalScrollbar && hscrollbar.Visible && hscrollbar.Max > 0)
            {
                vScrollbarHeight = (int)Height - 14;
            }
            else
            {
                vScrollbarHeight = (int)Height - 2;
            }

            vscrollbar       = new Scrollbar("vscrollbar", Position + new Vector2(Width - 13, 1), Scrollbar.Type.Vertical, vScrollbarHeight);
            vscrollbar.Owner = this.Owner;
            vscrollbar.Initialize(content, graphics);
            //vscrollbar.Visible = false;
        }
Пример #3
0
        public override void Dispose()
        {
            // TODO: dispose of your content here

            hScrollbar.Dispose();
            vScrollbar.Dispose();

            pixel.Dispose();
            renderTarget.Dispose();
            capturedTexture.Dispose();
            spriteBatch.Dispose();

            base.Dispose();
        }