public Game() { settings = GetSettings(); // Connect players if (settings.Players.Count(p => p == PlayerType.AI) > 0) { SocketForm socketForm = new SocketForm(settings); socketForm.Show(); socketManager = socketForm.CreateSocketManager(); socketForm.Close(); if (socketManager == null) return; } // Setup graphics graphics = new FormGraphics(); graphics.Show(); graphics.Closed += (sender, args) => Dispose(); // Get keyboard control KeyboardHandler keyboardHandler = new KeyboardHandler(graphics); gameManager = new GameManager(settings, keyboardHandler, socketManager, graphics); // Start game gameManager.Start(); }
/// <summary> ///Рисуем карту рисков /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void draw_risk_Click(object sender, EventArgs e) { try { DataSender ds = new DataSender(); ds.n = 1; ds.points = new List <ColorPoint>(); double scalecoeff = 50; // проходимся по дереву выбранных атрибутов, берем значение вероятности и влияния для выбранного элемента for (int ns = 10; ns < dataGridView1.Rows.Count; ns++) // перебираем столбцы (перебирая системы) { double x = (double)dataGridView1.Rows[ns].Cells[5].Value; // вероятность double y = (double)dataGridView1.Rows[ns].Cells[6].Value; // влияние string name = $"{dataGridView1.Rows[ns].Cells[1].Value}\r\n{dataGridView1.Rows[ns].Cells[2].Value}\r\n{dataGridView1.Rows[ns].Cells[3].Value}\r\n{dataGridView1.Rows[ns].Cells[4].Value}\r\n"; // $"Система - {rsk[ns - 1]}, \r\nЭлемент - {(string)dataGridView3.Rows[oldrowindex].Cells[0].Value}, \r\nАтрибут - {(string)dataGridView3.Rows[i + oldrowindex].Cells[0].Value}"; ColorPoint cp = new ColorPoint(x, y, 10 /*Радиус точки для отрисовки*/, name, dataGridView1.Rows[ns].DefaultCellStyle.BackColor, scalecoeff); ds.points.Add(cp); } FormGraphics fr = new FormGraphics(ds, $"Карта рисков\"{""}\"", own: this); fr.Show(); } catch (Exception ex) { } }
private void OnPaint(object sender, PaintEventArgs e) { // Draw all the shapes FormGraphics graphics = new FormGraphics(e.Graphics); foreach (Shape shape in shapes) { shape.Draw(graphics); } }
private void OnPaint(object sender, PaintEventArgs e) { IGraphics graphics = new FormGraphics(e.Graphics); this.drawShapes(graphics); }