Exemple #1
0
        /// <summary>
        ///  Initializes some important variables
        /// </summary>
        private void InitState()
        {
            // calculate number of lines required (being careful to count 1 for the last partial line)
            _linesCount = (_dataBuf.Length + _columnCount - 1) / _columnCount;

            _startLine = 0;
            if (_linesCount > _rowCount)
            {
                _displayLinesCount = _rowCount;
                _scrollBar.Hide();
                _scrollBar.Maximum     = _linesCount - 1;
                _scrollBar.LargeChange = _rowCount;
                _scrollBar.Show();
                _scrollBar.Enabled = true;
            }
            else
            {
                _displayLinesCount = _linesCount;
                _scrollBar.Hide();
                _scrollBar.Maximum     = _rowCount;
                _scrollBar.LargeChange = _rowCount;
                _scrollBar.Show();
                _scrollBar.Enabled = false;
            }
            _scrollBar.Select();
            Invalidate();
        }
Exemple #2
0
        /// <include file='doc\ByteViewer.uex' path='docs/doc[@for="ByteViewer.InitState"]/*' />
        /// <devdoc>
        ///     Initializes some important variables
        /// </devdoc>
        /// <internalonly/>
        private void InitState()
        {
            // calculate number of lines required (being careful to count 1 for the last partial line)
            linesCount = (dataBuf.Length + columnCount - 1) / columnCount;

            startLine = 0;
            if (linesCount > rowCount)
            {
                displayLinesCount = rowCount;
                scrollBar.Hide();
                scrollBar.Maximum     = linesCount - 1;
                scrollBar.LargeChange = rowCount;
                scrollBar.Show();
                scrollBar.Enabled = true;
            }
            else
            {
                displayLinesCount = linesCount;
                scrollBar.Hide();
                scrollBar.Maximum     = rowCount;
                scrollBar.LargeChange = rowCount;
                scrollBar.Show();
                scrollBar.Enabled = false;
            }
            scrollBar.Select();
            Invalidate();
        }
Exemple #3
0
 public void HideGroup(GroupBase group)
 {
     if (_layout != null)
     {
         if (_layout.Group != group)
         {
             return;
         }
         _groupScrollPosition[group] = _verticalScrollBar.Value;
         try
         {
             ServerLabel   serverLabel = Program.TheForm.ActiveControl as ServerLabel;
             ServerLabel[] labelArray  = _layout.LabelArray;
             foreach (ServerLabel serverLabel2 in labelArray)
             {
                 if (serverLabel == serverLabel2)
                 {
                     Program.TheForm.ActiveControl = this;
                 }
                 serverLabel2.Server.Hide();
                 base.Controls.Remove(serverLabel2);
             }
         }
         finally
         {
             _layout = null;
         }
     }
     _verticalScrollBar.Hide();
 }
Exemple #4
0
        private void ScrollBarsLayout()
        {
            _HScrollBar.Hide();
            _VScrollBar.Hide();

            int scrollHeight = this.Height - 2 * _FocusBorderWidth - _HScrollBar.Height;
            int scrollWidth  = this.Width - 2 * _FocusBorderWidth - _VScrollBar.Width;

            _HScrollBar.Width    = scrollWidth;
            _VScrollBar.Height   = scrollHeight;
            _HScrollBar.Location = new Point(_FocusBorderWidth, scrollHeight + _FocusBorderWidth);
            _VScrollBar.Location = new Point(scrollWidth + _FocusBorderWidth, _FocusBorderWidth);

            _HScrollBar.Show();
            _VScrollBar.Show();
        }
Exemple #5
0
        public void SyncItems(bool paint)
        {
            allItemHeight = 0;
            for (int i = 0; i < items.Count; i++)
            {
                items[i].ItemY = allItemHeight;
                allItemHeight += items[i].ItemHeight;
            }
            if (allItemHeight > Height)
            {
                outHeight = allItemHeight - Height;

                if (yOffest > outHeight && outHeight >= 0)
                {
                    yOffest = outHeight + 16;
                }

                scrol.Maximum     = allItemHeight;
                scrol.LargeChange = Height < 0 ? 0 : Height;
                scrol.SmallChange = allItemHeight / 50;
                scrol.Left        = Width - 16;
                scrol.Value       = yOffest + 16;
                scrol.Height      = Height;
                if (!scrol.Visible)
                {
                    scrol.Show();
                }
            }
            else
            {
                outHeight = 0;
                yOffest   = 0;
                if (scrol.Visible)
                {
                    scrol.Hide();
                }
            }
            if (paint)
            {
                Invalidate();
            }
        }
Exemple #6
0
        /// <summary>
        /// Initializes a new instance of the OwnerDrawnList class with default values.
        /// </summary>
        public OwnerDrawnList()
        {
            listItems = new ArrayList();
            //Create a ScrollBar instance
            vScroll = new VScrollBar();
            //Hide it for now
            vScroll.Hide();
            //Hookup into its ValueChanged event
            vScroll.ValueChanged += new EventHandler(vScrollcroll_ValueChanged);
            //Add Scrollbar
            vScroll.Value = 0;

            this.Controls.Add(vScroll);

            SCROLL_WIDTH = vScroll.Width;

            itemWidth = this.Width;

            origHeight = this.Height;

            this.BackColor = Color.Red;
        }
        private void Adjust_ScrollBar()
        {
            int        viewHeight = ((Window)ParentRef).ShowScrollHeight;
            VScrollBar scroll     = ((Window)ParentRef).ScrollBar;

            if (VirtualHeight > viewHeight)
            {
                scroll.LargeChange = viewHeight / 4;
                scroll.Maximum     = (VirtualHeight - viewHeight) / Window.SCROLL_FACTOR;
                scroll.Maximum    += scroll.LargeChange;
                if (!scroll.Visible)
                {
                    scrollToggled = true;
                    scroll.Show();
                }
            }
            else if (scroll.Visible)
            {
                scrollToggled = true;
                scroll.Hide();
            }
        }
Exemple #8
0
        private void UpdateScrollBars()
        {
            // Note: the view pointer has already been validated by the caller (OnSize method)
            int viewWidth  = m_pView.BufferAreaWidth;
            int viewHeight = m_pView.BufferAreaHeight;
            int pageWidth  = m_pView.BufferAreaWidth;
            int pageHeight = m_pView.BufferAreaHeight;

            switch (m_pView.ScalingMode)
            {
            case SapView.DisplayScalingMode.None:
            {
                if (m_pView.Buffer != null)
                {
                    viewWidth  = m_pView.Buffer.Width;
                    viewHeight = m_pView.Buffer.Height;
                }
                break;        // pageWidth and pageHeight are already initialized correctly
            }

            case SapView.DisplayScalingMode.FitToWindow:
            {
                // viewWidth and viewHeight are already initialized correctly
                // pageWidth and pageHeight are already initialized correctly
                break;
            }

            case SapView.DisplayScalingMode.Zoom:
            case SapView.DisplayScalingMode.UserDefined:
            {
                if (m_pView.Buffer != null)
                {
                    viewWidth  = (int)(m_pView.Buffer.Width);
                    viewHeight = (int)(m_pView.Buffer.Height);
                }
                pageWidth  = (int)(m_pView.ScalingSrcArea.Width);
                pageHeight = (int)(m_pView.ScalingSrcArea.Height);
                break;
            }
            }


            if (hScroll != null && vScroll != null)
            {
                // Size Horitontal scrollbar
                hScroll.Minimum     = 0;
                hScroll.Maximum     = (int)((float)(viewWidth + 0.5) - 1);
                hScroll.LargeChange = pageWidth;
                hScroll.Value       = m_pView.HorzScrollPosition;


                // Size Vertical scrollbar
                vScroll.Minimum     = 0;
                vScroll.Maximum     = (int)(((float)viewHeight + 0.5) - 1);
                vScroll.LargeChange = pageHeight;
                vScroll.Value       = m_pView.VertScrollPosition;

                // Show/hide scroll bars

                if (m_pView.HorzScrollRange > 0)
                {
                    hScroll.Show();
                }
                else
                {
                    hScroll.Hide();
                }
                if (m_pView.VertScrollRange > 0)
                {
                    vScroll.Show();
                }
                else
                {
                    vScroll.Hide();
                }
            }
        }