/// <summary> /// Method to paint the wave /// </summary> /// <param name="e"></param> protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); scrollBar.Invalidate(); scrollBar.Refresh(); drawHeight = Height - scrollBar.ClientRectangle.Height; Graphics g = e.Graphics; drawSelection(g); drawGrid(g); drawWave(g); }
public void SetScrollBarBounds(bool setVertical, bool setHorizontal) { if (setVertical) { VScrollBar.Bounds = new Rectangle(TextArea.Bounds.Right, 0, SystemInformation.HorizontalScrollBarArrowWidth, setHorizontal ? Height - SystemInformation.VerticalScrollBarArrowHeight : Height); VScrollBar.Invalidate(); } if (setHorizontal) { HScrollBar.Bounds = new Rectangle(0, TextArea.Bounds.Bottom, Width - SystemInformation.HorizontalScrollBarArrowWidth, SystemInformation.VerticalScrollBarArrowHeight); HScrollBar.Invalidate(); } }
public void timerTick(int msTime) { int msVal = msTime % 1000; int secPos = msTime / 1000; int secVal = secPos % 60; int minPos = secPos / 60; int minVal = minPos % 60; int hrVal = minPos / 60; lblPosCounter.Text = hrVal.ToString("D2") + ":" + minVal.ToString("D2") + ":" + secVal.ToString("D2") + "." + msVal.ToString("D3"); int sliderPos = msTime / audioFile.duration; //slider max val = 1000, duration in sec hsbPosSelector.Value = sliderPos; lblPosCounter.Invalidate(); hsbPosSelector.Invalidate(); }
void ResizeControl() { _splitContainer.Size = new Size( Width - _vScrollBar.Width - 1, Height - _hScrollBar.Height - 1); int w = _splitContainer.Panel2.Width; int h = _splitContainer.Panel2.Height; if (w < 0 || w > _matrix.Width) { _hScrollBar.Visible = false; OffsetX = 0; } else { _hScrollBar.Location = new Point(_splitContainer.Panel2.Left, _splitContainer.Height); _hScrollBar.Size = new Size(_splitContainer.Panel2.Width, _hScrollBar.Height); _hScrollBar.Maximum = _matrix.Width; _hScrollBar.LargeChange = Math.Max(_splitContainer.Panel2.Width, 0); _hScrollBar.SmallChange = _displayOptions.CellHeight; // adjust offset so that last scroll does not go past end if (OffsetX + w > _matrix.Width) { OffsetX -= (OffsetX + w - _matrix.Width); } if (OffsetX < 0) { OffsetX = 0; } _hScrollBar.Value = OffsetX; _hScrollBar.Visible = true; } if (h < 0 || h > _matrix.Height) { _vScrollBar.Visible = false; OffsetY = 0; } else { _vScrollBar.Location = new Point(_splitContainer.Width, _displayOptions.RootHeight + 1); _vScrollBar.Size = new Size(_vScrollBar.Width, _splitContainer.Height - _displayOptions.RootHeight); _vScrollBar.Maximum = _matrix.Height - _displayOptions.RootHeight; _vScrollBar.LargeChange = Math.Max(0, _splitContainer.Panel2.Height - _displayOptions.RootHeight); _vScrollBar.SmallChange = _displayOptions.CellHeight; if (OffsetY + h > _matrix.Height) { OffsetY -= (OffsetY + h - _matrix.Height); } if (OffsetY < 0) { OffsetY = 0; } _vScrollBar.Value = OffsetY; _vScrollBar.Visible = true; } _vScrollBar.Invalidate(); _hScrollBar.Invalidate(); }