private void DefaultBasisInput_Load(object sender, EventArgs e) { titleLabel1 = new Label(); titleLabel1.Location = new Point(firstControlLocation, firstControlLocation); titleLabel1.Text = "Каноническая форма задачи, введенной вами:"; titleLabel1.AutoSize = true; titleLabel1.Font = new Font("Microsoft Sans Serif", 10F); canonicalProblemLabel = new Label(); canonicalProblemLabel.Location = new Point(firstControlLocation, firstControlLocation + titleLabel1.Height + verticalDistanceBetweenControls); canonicalProblemLabel.Text = canonicalProblem.ToString(); canonicalProblemLabel.AutoSize = true; canonicalProblemLabel.Font = new Font("Microsoft Sans Serif", 10F); titleLabel2 = new Label(); titleLabel2.Location = new Point(firstControlLocation, canonicalProblemLabel.Location.Y + (canonicalProblem.LimitationNumber + 2) * canonicalProblemLabel.Height + verticalDistanceBetweenControls); titleLabel2.Text = "Векторы, образованные в данной ЗЛП"; titleLabel2.AutoSize = true; titleLabel2.Font = new Font("Microsoft Sans Serif", 10F); vectorCheckBoxes = new CheckBox[canonicalProblem.VariableNumber]; limitationVectorLabel = new Label(); limitationVectorLabel.Location = new Point(firstControlLocation, titleLabel2.Location.Y + titleLabel2.Height + 2 * verticalDistanceBetweenControls); limitationVectorLabel.Text = "A0: " + Convert.ToString(canonicalProblem.LimitationVector); limitationVectorLabel.AutoSize = true; limitationVectorLabel.Font = new Font("Microsoft Sans Serif", 10F); for (int j = 0; j < vectorCheckBoxes.Length; j++) { vectorCheckBoxes[j] = new CheckBox(); if (j == 0) { vectorCheckBoxes[j].Location = new Point(firstControlLocation, limitationVectorLabel.Location.Y + limitationVectorLabel.Height + verticalDistanceBetweenControls); } else { vectorCheckBoxes[j].Location = new Point(firstControlLocation, vectorCheckBoxes[j - 1].Location.Y + vectorCheckBoxes[j - 1].Height + verticalDistanceBetweenControls); } vectorCheckBoxes[j].Text = "A" + Convert.ToString(j + 1) + ": " + Convert.ToString(canonicalProblem.LimitationMatrix.GetColumn(j)); vectorCheckBoxes[j].AutoSize = true; vectorCheckBoxes[j].Font = new Font("Microsoft Sans Serif", 10F); vectorCheckBoxes[j].CheckedChanged += new EventHandler(checkBoxes_CheckedChanged); } titleLabel3 = new Label(); titleLabel3.Location = new Point(firstControlLocation, vectorCheckBoxes[vectorCheckBoxes.Length - 1].Location.Y + vectorCheckBoxes[vectorCheckBoxes.Length - 1].Height + verticalDistanceBetweenControls); titleLabel3.Text = "Пожалуйста выберите вектора, которые будут базисными."; titleLabel3.AutoSize = true; titleLabel3.Font = new Font("Microsoft Sans Serif", 10F); AutoSize = true; continueButton = new Button(); continueButton.Location = new Point(firstControlLocation, titleLabel3.Location.Y + titleLabel3.Height + verticalDistanceBetweenControls); continueButton.Size = new Size((Width - 2 * firstControlLocation - distanceBetweenButtons), buttonHeight); continueButton.Font = new Font("Microsoft Sans Serif", 15F); continueButton.Text = "Продолжить"; continueButton.UseVisualStyleBackColor = true; continueButton.Click += new EventHandler(continueButton_Click); toPreviousFormButton = new Button(); toPreviousFormButton.Location = new Point(firstControlLocation + continueButton.Width + distanceBetweenButtons, continueButton.Location.Y); toPreviousFormButton.Size = new Size((Width - 2 * firstControlLocation - distanceBetweenButtons) / 2, buttonHeight); toPreviousFormButton.Font = new Font("Microsoft Sans Serif", 15F); toPreviousFormButton.Text = "Назад"; toPreviousFormButton.UseVisualStyleBackColor = true; toPreviousFormButton.Click += new EventHandler(toPreviousFormButton_Click); Text = "Ввод исходного базиса"; AcceptButton = continueButton; CancelButton = toPreviousFormButton; Controls.Add(titleLabel1); Controls.Add(canonicalProblemLabel); Controls.Add(titleLabel2); Controls.Add(limitationVectorLabel); foreach (CheckBox checkBox in vectorCheckBoxes) { Controls.Add(checkBox); } Controls.Add(titleLabel3); Controls.Add(continueButton); Controls.Add(toPreviousFormButton); MaximumSize = MinimumSize = Size; }
private void DefaultSolutionInput_Load(object sender, EventArgs e) { int formWidth = 0; titleLabel1 = new Label(); titleLabel1.Location = new Point(firstControlLocation, firstControlLocation); titleLabel1.Text = "Каноническая форма задачи, введенной вами:"; titleLabel1.AutoSize = true; titleLabel1.Font = new Font("Microsoft Sans Serif", 10F); canonicalProblemLabel = new Label(); canonicalProblemLabel.Location = new Point(firstControlLocation, firstControlLocation + titleLabel1.Height + verticalDistanceBetweenControls); canonicalProblemLabel.Text = canonicalProblem.ToString(); canonicalProblemLabel.AutoSize = true; canonicalProblemLabel.Font = new Font("Microsoft Sans Serif", 10F); titleLabel2 = new Label(); titleLabel2.Location = new Point(firstControlLocation, canonicalProblemLabel.Location.Y + (canonicalProblem.LimitationNumber + 2) * canonicalProblemLabel.Height + verticalDistanceBetweenControls); titleLabel2.Text = "Пожалуйста, введите допустимое опорное решение:"; titleLabel2.AutoSize = true; titleLabel2.Font = new Font("Microsoft Sans Serif", 10F); defaultSolutionTextBoxes = new TextBox[canonicalProblem.VariableNumber]; defaultSolutionLabels = new Label[canonicalProblem.VariableNumber + 1]; defaultSolutionLabels[0] = new Label(); defaultSolutionLabels[0].Location = new Point(firstControlLocation, titleLabel2.Location.Y + titleLabel2.Height + verticalDistanceBetweenControls); defaultSolutionLabels[0].Text = canonicalProblem.VariableSymbol + "* = ("; defaultSolutionLabels[0].AutoSize = true; defaultSolutionLabels[0].Font = new Font("Microsoft Sans Serif", 10F); for (int j = 0; j < defaultSolutionTextBoxes.Length; j++) { defaultSolutionTextBoxes[j] = new TextBox(); defaultSolutionTextBoxes[j].Location = new Point(defaultSolutionLabels[j].Location.X + defaultSolutionLabels[j].Width + horizontalDistanceBetweenControls, defaultSolutionLabels[0].Location.Y); defaultSolutionTextBoxes[j].Size = new Size(textBoxWidth, textBoxHeight); defaultSolutionTextBoxes[j].Text = "0"; defaultSolutionLabels[j + 1] = new Label(); defaultSolutionLabels[j + 1].Location = new Point(defaultSolutionTextBoxes[j].Location.X + defaultSolutionTextBoxes[j].Width + horizontalDistanceBetweenControls, defaultSolutionLabels[0].Location.Y); defaultSolutionLabels[j + 1].Text = j == defaultSolutionTextBoxes.Length - 1 ? ")" : ";"; defaultSolutionLabels[j + 1].AutoSize = true; defaultSolutionLabels[j + 1].Font = new Font("Microsoft Sans Serif", 10F); } formWidth = 2 * firstControlLocation + defaultSolutionLabels[0].Width; for (int j = 0; j < defaultSolutionTextBoxes.Length; j++) { formWidth += 2 * horizontalDistanceBetweenControls + textBoxWidth + defaultSolutionLabels[j + 1].Width; } continueButton = new Button(); continueButton.Location = new Point(firstControlLocation, defaultSolutionLabels[0].Location.Y + textBoxHeight + verticalDistanceBetweenControls); continueButton.Size = new Size((formWidth - 2 * firstControlLocation - distanceBetweenButtons) / 2, buttonHeight); continueButton.Font = new Font("Microsoft Sans Serif", 15F); continueButton.Text = "Продолжить"; continueButton.UseVisualStyleBackColor = true; continueButton.Click += new EventHandler(continueButton_Click); toPreviousFormButton = new Button(); toPreviousFormButton.Location = new Point(firstControlLocation + continueButton.Width + distanceBetweenButtons, continueButton.Location.Y); toPreviousFormButton.Size = new Size((formWidth - 2 * firstControlLocation - distanceBetweenButtons) / 2, buttonHeight); toPreviousFormButton.Font = new Font("Microsoft Sans Serif", 15F); toPreviousFormButton.Text = "Назад"; toPreviousFormButton.UseVisualStyleBackColor = true; toPreviousFormButton.Click += new EventHandler(toPreviousFormButton_Click); Text = "Ввод исходного опорного решения"; AutoSize = true; AcceptButton = continueButton; CancelButton = toPreviousFormButton; Controls.Add(titleLabel1); Controls.Add(canonicalProblemLabel); Controls.Add(titleLabel2); foreach (TextBox textBox in defaultSolutionTextBoxes) { Controls.Add(textBox); } foreach (Label label in defaultSolutionLabels) { Controls.Add(label); } Controls.Add(continueButton); Controls.Add(toPreviousFormButton); MaximumSize = MinimumSize = Size; }