public override void OnPaint(PaintEventArgs e) { ConsoleGraphics g = e.Graphics; var items = _items; g.FillRectangle(ColorResources.ListViewBackgroundColor, Position.X, Position.Y, Size.Width, Size.Height); int lastIndex = _visibleItemsFirstIndex + _visibleItemsCount > items.Count ? items.Count : _visibleItemsFirstIndex + _visibleItemsCount; for (int i = _visibleItemsFirstIndex; i < lastIndex; i++) { items[i].Draw(g, new Point(_itemsStartPosition.X + NumericConstants.MarginUpLeft, _itemsStartPosition.Y + (i - _visibleItemsFirstIndex) * NumericConstants.ListViewItemHeight + NumericConstants.MarginUpLeft), new Size(NumericConstants.ListViewItemHeight, Size.Width - NumericConstants.MarginRightDown)); } g.DrawLine(ColorResources.AppBackground, Position.X, Position.Y + NumericConstants.ListViewItemHeight, Position.X + Size.Width, Position.Y + NumericConstants.ListViewItemHeight, NumericConstants.WindowBorderThikness); g.DrawLine(ColorResources.AppBackground, Position.X, Size.Height - NumericConstants.ListViewItemHeight, Position.X + Size.Width, Size.Height - NumericConstants.ListViewItemHeight, NumericConstants.WindowBorderThikness); g.DrawString(_drawingPath, StringResources.FontName, ColorResources.ListItemTextColor, Position.X, Position.Y, NumericConstants.FontSize); g.DrawString($"{SelectedIndex + 1}/{this._items.Count}", StringResources.FontName, ColorResources.ListItemTextColor, Position.X + 22, Size.Height - NumericConstants.ListViewItemHeight + 3, NumericConstants.FontSize); }
public void DrawSuare() { graphics.DrawLine(0xFFFF0000, x, y, x + side, y, 5); graphics.DrawLine(0xFFFF0000, x + side, y, side + x, side + y, 5); graphics.DrawLine(0xFFFF0000, x + side, y + side, x, side + y, 5); graphics.DrawLine(0xFFFF0000, x, y, x, y + side, 5); }
public void Render(ConsoleGraphics graphics) { for (int i = 0; i < FieldSize.numberCellWidth; i++) { for (int j = 0; j < FieldSize.numberCellHeigh; j++) { if (fieldGrid[i, j] == 1) { graphics.FillRectangle(ColorFigure.figureColor, FieldSize.width * i + FieldSize.xMin, FieldSize.height * j + FieldSize.yMin, FieldSize.width, FieldSize.height); if (j == 0) { game.GameIsOn = false; } } } } figure?.Render(graphics); for (int i = FieldSize.xMin; i <= FieldSize.xMax; i += FieldSize.width * 10) { graphics.DrawLine(ColorFigure.fieldColor, i, FieldSize.yMin, i, FieldSize.yMax, 3); } for (int i = FieldSize.yMin; i <= FieldSize.yMax; i += FieldSize.height * 20) { graphics.DrawLine(ColorFigure.fieldColor, FieldSize.xMin, i, FieldSize.xMax, i, 3); } }
public void DrawTStar() { graphics.DrawLine(0xFFFF0000, x, y, x + side / 2, (side / 2) + y, 5); graphics.DrawLine(0xFFFF0000, x, y, x - side / 2, (side / 2) + y, 5); graphics.DrawLine(0xFFFF0000, x - side / 2, (side / 2) + y - side / 4, x + side / 2, (side / 2) + y - side / 4, 5); graphics.DrawLine(0xFFFF0000, x + side / 2, (side / 2) + y - side / 4, x - side / 2, (side / 2) + y, 5); graphics.DrawLine(0xFFFF0000, x - side / 2, (side / 2) + y - side / 4, x + side / 2, (side / 2) + y, 5); }
private void DrawDatails(string diskName) { _graphic.FillRectangle(0xff000000, Indent + 1, 0, (_graphic.ClientWidth / 2), _graphic.ClientHeight); _graphic.DrawString($"{diskName}", "Arial", 0xffffffff, Indent, 0, 12); _graphic.DrawString("F1-copy : F2-cut : F3-paste : F4-list of disks : F5-properties : F6-rename : F7-criate folder", "Arial", 0xffffffff, 0, _graphic.ClientHeight - _actions.LineHeight, 10); _graphic.DrawLine(0xffffffff, _graphic.ClientWidth / 2, 0, _graphic.ClientWidth / 2, _graphic.ClientHeight - _actions.LineHeight); _graphic.DrawLine(0xffffffff, 0, _graphic.ClientHeight - _actions.LineHeight, _graphic.ClientWidth, _graphic.ClientHeight - _actions.LineHeight); _graphic.DrawLine(0xffffffff, 0, _actions.LineHeight - 1, _graphic.ClientWidth, _actions.LineHeight - 1); }
public void Render(ConsoleGraphics graphics) { for (int j = 0; j < r; j++) { for (int i = 0; i < 360; i++) { double currentAngle = i / Math.PI / 2; double prevAngle = (i - 1) / Math.PI / 2; graphics.DrawLine(0xFF00FF00, (int)(x + j * Math.Cos(prevAngle)), (int)(y + j * Math.Sin(prevAngle)), (int)(x + j * Math.Cos(currentAngle)), (int)(y + j * Math.Sin(currentAngle)) ); } } if (x - r <= 0 || x + r >= graphics.ClientWidth) { speedX *= -1; } if (y - r <= 0) { speedY *= -1; } }
public void Render(ConsoleGraphics graphics) { for (int i = 0; i < grid.GetLength(0); i++) { for (int j = 0; j < grid.GetLength(1); j++) { if (grid[i, j] == 1) { graphics.FillRectangle(0xFF0FF0F0, width * i + xMin, height * j + yMin, width, height); } } } figure?.Render(graphics); for (int i = xMin; i <= xMax; i += (xMax - xMin) / numberWightCells) { graphics.DrawLine(0xFF000000, i, yMin, i, yMax); } for (int i = yMin; i <= yMax; i += (yMax - yMin) / numberHeightCells) { graphics.DrawLine(0xFF000000, xMin, i, xMax, i); } }
static void Main(string[] args) { Console.CursorVisible = false; ConsoleGraphics graphics = new ConsoleGraphics(); uint color = 0xFFFF0000; int xStart = 0; int xEnd = 100; int yStart = 0; int yEnd = 100; int thickness = 5; graphics.DrawLine(color, xStart, yStart, xEnd, yEnd, thickness); graphics.FlipPages(); Console.ReadLine(); }
public void Render(ConsoleGraphics graphics) { graphics.DrawLine(color, start.X, start.Y, end.X, end.Y, thickness); }
public void DrawTriangle() { graphics.DrawLine(0xFFFF0000, x, y, x + side / 2, (side / 2) + y, 5); graphics.DrawLine(0xFFFF0000, x, y, x - side / 2, (side / 2) + y, 5); graphics.DrawLine(0xFFFF0000, x - side / 2, (side / 2) + y, x + side / 2, (side / 2) + y, 5); }
public void Render(ConsoleGraphics graphics) { graphics.FillRectangle(_color, 0, 0, Width, Height); graphics.DrawLine(0xFFbd1a1a, xMax, 0, xMax, yMax, 2); graphics.DrawLine(0xFFbd1a1a, 0, yMax, xMax, yMax, 2); }