public void CreateMatrix(int rows) { Matrix = new InputCountBox[rows, rows]; int stepX = 8; int stepY = 8; int width = 30; int height = 20; int positionX = 0; int positionY = 0; for (int i = 0; i < rows; ++i) { for (int j = 0; j < rows; ++j) { Matrix[i, j] = new InputCountBox(width, height, positionX + (width + stepX) * i, positionY + (height + stepY) * j); if (i == j) { Matrix[i, j].Enabled = false; } matrixPanel.Controls.Add(Matrix[i, j]); } } }
public InputCountVertexForm(StartForm.StartForm startForm) { InitializeComponent(); StartPosition = FormStartPosition.CenterScreen; Text = "GraphVizualizer / Matrix"; this.BackColor = Color.DarkGray; matrixPanel = new MatrixWeightTablePanel(350, 290, Width / 2 - 190, 155); matrixGraph = new MatrixGraph(matrixPanel); inputBox = new InputCountBox(300, 20, 200, 100); Controls.Add(inputBox); infoText = new InfoTextLabel(300, 30, 200, 80); Controls.Add(infoText); confirmButton = new ConfirmButton(100, 30, 500, 100, inputBox, matrixGraph); Controls.Add(confirmButton); backToMenuOfInputButton = new BackToMenuFromInputButton(matrixGraph, this); Controls.Add(backToMenuOfInputButton); drawVertexButton = new DrawVertexButton(100, 30, 600, 100, this, matrixGraph, startForm); Controls.Add(drawVertexButton); Controls.Add(matrixPanel); }
public ConfirmButton(int width, int height, int positionX, int positionY, InputCountBox inputCountBox , MatrixGraph matrixGraph, string buttonText = "OK") { ForeColor = Color.Black; this.BackColor = Color.Orange; Font = new System.Drawing.Font("Comic Sans MS", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(204))); FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.Text = buttonText; this.Size = new System.Drawing.Size(width, height); this.Location = new System.Drawing.Point(positionX, positionY); this.inputCountBox = inputCountBox; Click += new EventHandler(ButtonClick); this.matrixGraph = matrixGraph; }