ComponentFactory.Krypton.Toolkit.ViewDrawScrollBar.RemoveScrollBar C# (CSharp) Method

RemoveScrollBar() private method

private RemoveScrollBar ( ) : void
return void
        private void RemoveScrollBar()
        {
            // Do we need to remove the scrollbar?
            if ((_scrollBar != null) && !_removing)
            {
                // Prevent recreate of the control during removal, as removing it
                // will cause more layout cycles to occur. We put it back to false
                // at the end of the remove process.
                _removing = true;

                // Unhook from events
                _scrollBar.Scroll -= new ScrollEventHandler(OnScrollBarChange);

                // Hide the scrollbar from view
                _scrollBar.Hide();

                // Remove scrollbar from containing collection
                CommonHelper.RemoveControlFromParent(_scrollBar);

                // Destroy the current scrollbar
                _scrollBar.Dispose();
                _scrollBar = null;

                _removing = false;
            }
        }