namespace WindowsFormsApplication3 { partial class Form2 { /// /// Требуется переменная конструктора. /// private System.ComponentModel.IContainer components = null; /// /// Освободить все используемые ресурсы. /// /// истинно, если управляемый ресурс должен быть удален; иначе ложно. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Код, автоматически созданный конструктором форм Windows /// /// Обязательный метод для поддержки конструктора - не изменяйте /// содержимое данного метода при помощи редактора кода. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.Number1 = new System.Windows.Forms.TextBox(); this.Number2 = new System.Windows.Forms.TextBox(); this.Ок = new System.Windows.Forms.Button(); this.Cancel = new System.Windows.Forms.Button(); this.Summa = new System.Windows.Forms.CheckBox(); this.MaxDivisor = new System.Windows.Forms.CheckBox(); this.Multiplay = new System.Windows.Forms.CheckBox(); this.error1 = new System.Windows.Forms.ErrorProvider(this.components); this.error2 = new System.Windows.Forms.ErrorProvider(this.components); ((System.ComponentModel.ISupportInitialize)(this.error1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.error2)).BeginInit(); this.SuspendLayout(); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(35, 61); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(53, 13); this.label1.TabIndex = 0; this.label1.Text = "Number 1"; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(187, 61); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(53, 13); this.label2.TabIndex = 1; this.label2.Text = "Number 2"; // // Number1 // this.Number1.Location = new System.Drawing.Point(38, 91); this.Number1.Name = "Number1"; this.Number1.Size = new System.Drawing.Size(62, 20); this.Number1.TabIndex = 2; this.Number1.GotFocus += new System.EventHandler(this.Number1_GotFocus); // // Number2 // this.Number2.Location = new System.Drawing.Point(178, 91); this.Number2.Name = "Number2"; this.Number2.Size = new System.Drawing.Size(62, 20); this.Number2.TabIndex = 3; this.Number2.GotFocus += new System.EventHandler(this.Number2_GotFocus); // // Ок // this.Ок.Location = new System.Drawing.Point(36, 203); this.Ок.Name = "Ок"; this.Ок.Size = new System.Drawing.Size(63, 32); this.Ок.TabIndex = 4; this.Ок.Text = "Ок"; this.Ок.UseVisualStyleBackColor = true; this.Ок.Click += new System.EventHandler(this.Ок_Click); // // Cancel // this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.Cancel.Location = new System.Drawing.Point(189, 203); this.Cancel.Name = "Cancel"; this.Cancel.Size = new System.Drawing.Size(63, 32); this.Cancel.TabIndex = 5; this.Cancel.Text = "Cancel"; this.Cancel.UseVisualStyleBackColor = true; // // Summa // this.Summa.AutoSize = true; this.Summa.Location = new System.Drawing.Point(105, 117); this.Summa.Name = "Summa"; this.Summa.Size = new System.Drawing.Size(61, 17); this.Summa.TabIndex = 6; this.Summa.Text = "Summa"; this.Summa.UseVisualStyleBackColor = true; // // MaxDivisor // this.MaxDivisor.AutoSize = true; this.MaxDivisor.Location = new System.Drawing.Point(105, 140); this.MaxDivisor.Name = "MaxDivisor"; this.MaxDivisor.Size = new System.Drawing.Size(79, 17); this.MaxDivisor.TabIndex = 7; this.MaxDivisor.Text = "Max divisor"; this.MaxDivisor.UseVisualStyleBackColor = true; // // Multiplay // this.Multiplay.AutoSize = true; this.Multiplay.Location = new System.Drawing.Point(105, 163); this.Multiplay.Name = "Multiplay"; this.Multiplay.Size = new System.Drawing.Size(67, 17); this.Multiplay.TabIndex = 8; this.Multiplay.Text = "Multiplay\r\n"; this.Multiplay.UseVisualStyleBackColor = true; // // error1 // this.error1.ContainerControl = this; // // error2 // this.error2.ContainerControl = this; // // Form2 // this.AcceptButton = this.Ок; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.Cancel; this.ClientSize = new System.Drawing.Size(284, 262); this.Controls.Add(this.Multiplay); this.Controls.Add(this.MaxDivisor); this.Controls.Add(this.Summa); this.Controls.Add(this.Cancel); this.Controls.Add(this.Ок); this.Controls.Add(this.Number2); this.Controls.Add(this.Number1); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "Form2"; this.Text = "Form2"; this.Load += new System.EventHandler(this.Form2_Load); ((System.ComponentModel.ISupportInitialize)(this.error1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.error2)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } void Number2_GotFocus(object sender, System.EventArgs e) { if (Count_2_2 < Count_2_1) { error2.Dispose(); Number2.Clear(); Number2.ForeColor = System.Drawing.Color.Black; Count_2_2++; } } void Number1_GotFocus(object sender, System.EventArgs e) { if (Count_1_2 < Count_1_1) { error1.Dispose(); Number1.Clear(); Number1.ForeColor = System.Drawing.Color.Black; Count_1_2++; } } public bool summa { get { return this.Summa.Checked; } } public bool maxDivisor { get { return this.MaxDivisor.Checked; } } public bool multiplay { get { return this.Multiplay.Checked; } } static private int Count_1_1 = 0; static private int Count_1_2 = 0; static private int Count_2_1 = 0; static private int Count_2_2 = 0; void Ок_Click(object sender, System.EventArgs e) { if (!double.TryParse(Number1.Text, out Form1.Number1)) { Number1.ForeColor = System.Drawing.Color.Red; Count_1_1++; error1.SetError(Number1, "Неверный формат"); Cancel.Focus(); } if (!double.TryParse(Number2.Text, out Form1.Number2)) { error2.SetError(Number2, "Неверный формат"); Number2.ForeColor = System.Drawing.Color.Red; Count_2_1++; Cancel.Focus(); } if (double.TryParse(Number1.Text, out Form1.Number1) && double.TryParse(Number2.Text, out Form1.Number2)) { DialogResult = System.Windows.Forms.DialogResult.OK; } } #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private System.Windows.Forms.TextBox Number1; private System.Windows.Forms.TextBox Number2; private System.Windows.Forms.Button Ок; private System.Windows.Forms.Button Cancel; private System.Windows.Forms.CheckBox Summa; private System.Windows.Forms.CheckBox MaxDivisor; private System.Windows.Forms.CheckBox Multiplay; private System.Windows.Forms.ErrorProvider error1; private System.Windows.Forms.ErrorProvider error2; } }