internal new void Draw() { base.Draw(); LeftButton.Draw(); RightButton.Draw(); horizontalSlider.Draw(); }
public void Draw(object sender, PaintEventArgs e) { e.Graphics.DrawRectangle(new Pen(Color.Red), outlineRectangle); text.Draw(sender, e); slider.Draw(sender, e); if (head.Point.X > point.X && head.Point.X + head.Size.Width <= point.X + size.Width) { head.Draw(sender, e); } for (int i = 0; i < tape.Count; i++) { if (tape[i].Point.X > point.X && tape[i].Point.X + tape[i].Size.Width < point.X + size.Width) { tape[i].Draw(sender, e); } } foreach (var button in buttons) { button.Draw(sender, e); } }
/// <summary> /// Actually controls the basic drawing control. /// </summary> /// <param name="g">The graphics object used for drawing.</param> /// <param name="clipRectangle">The clip rectangle.</param> protected virtual void OnDraw(Graphics g, Rectangle clipRectangle) { Brush b = new SolidBrush(LineColor); foreach (SquareButton vButton in _verticalButtons) { foreach (SquareButton hButton in _horizontalButtons) { float x = hButton.Bounds.X; float y = vButton.Bounds.Y; if (hButton.IsDown && vButton.IsDown) { g.FillRectangle(b, x, y, _blockSize.Width, _blockSize.Height); } else { g.FillRectangle(Brushes.White, x, y, _blockSize.Width, _blockSize.Height); } g.DrawRectangle(Pens.Gray, x, y, _blockSize.Width, _blockSize.Height); } } for (int v = 0; v < Height / _blockSize.Height; v++) { float y = v * _blockSize.Height; if (y < clipRectangle.Y - _blockSize.Height) { continue; } if (y > clipRectangle.Bottom + _blockSize.Height) { continue; } for (int u = 0; u < Width / _blockSize.Width; u++) { float x = u * _blockSize.Width; if (x < clipRectangle.X - _blockSize.Width) { continue; } if (x > clipRectangle.Right + _blockSize.Width) { continue; } g.DrawRectangle(Pens.Gray, x, y, _blockSize.Width, _blockSize.Height); } } foreach (SquareButton button in _horizontalButtons) { button.Draw(g, clipRectangle); } foreach (SquareButton button in _verticalButtons) { button.Draw(g, clipRectangle); } HorizontalSlider.Draw(g, clipRectangle); VerticalSlider.Draw(g, clipRectangle); }