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(); }
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(); } } }
public bool Vsitem(bool b = false) { if (moveItem != null) { return(false); } if (b && parent.ishs) { HScrollBar vs = (HScrollBar)(parent.Controls["HScrollBarBase"]); if (parent.Width != 0) { if (parent.isvs) { vs.Width = parent.Width - 16; } else { vs.Width = parent.Width; } } else { vs.Width = Width; } } if (!vsed) { int thisWidth = 0; for (int i = 0; i < sortedItems.Count; i++) { sortedItems[i].X = thisWidth; thisWidth += sortedItems[i].Width; } vsed = true; if (thisWidth == 0) { return(false); } if (parent != null) { HScrollBar vs = (HScrollBar)(parent.Controls["HScrollBarBase"]); if (thisWidth > Width) { parent.ishs = true; if (!vs.Visible) { vs.Show(); } if (vs.Width == 0) { vs.Width = Width; } vs.Maximum = thisWidth; vs.LargeChange = parent.Width; vs.SmallChange = 5; int targetVal = vs.Value - vs.Minimum; if (xOffiest != targetVal) { xOffiest = targetVal; XOffestChanged?.Invoke(this, null); } } else { parent.ishs = false; if (vs.Visible) { vs.Hide(); } if (xOffiest != 0) { xOffiest = 0; XOffestChanged?.Invoke(this, null); } } allWidth = thisWidth; return(true); } allWidth = thisWidth; return(true); } return(false); }
public override void Hide() { myLabel.Hide(); myScrollBar.Hide(); }