using System; using System.Collections; using System.ComponentModel; using System.Drawing; using System.Data; using System.Windows.Forms; namespace By2 { // Summary description for ButtonsControl. public class ButtonsControl : System.Windows.Forms.UserControl { // Required designer variable. private Form1 f1; private ArrayList bArrList; private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Button button16; private System.Windows.Forms.Button button15; private System.Windows.Forms.Button button14; private System.Windows.Forms.Button button13; private System.Windows.Forms.Button button12; private System.Windows.Forms.Button button11; private System.Windows.Forms.Button button10; private System.Windows.Forms.Button button9; private System.Windows.Forms.Button button8; private System.Windows.Forms.Button button7; private System.Windows.Forms.Button button6; private System.Windows.Forms.Button button5; private System.Windows.Forms.Button button4; private System.Windows.Forms.Button button3; private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button1; public ArrayList parameterList; public void SetParent(Form1 fKey) { f1 = fKey; } private System.ComponentModel.Container components = null; public ButtonsControl() { InitializeComponent(); bArrList = new ArrayList(); bArrList.Add(button16); bArrList.Add(button15); bArrList.Add(button14); bArrList.Add(button13); bArrList.Add(button12); bArrList.Add(button11); bArrList.Add(button10); bArrList.Add(button9); bArrList.Add(button8); bArrList.Add(button7); bArrList.Add(button6); bArrList.Add(button5); bArrList.Add(button4); bArrList.Add(button3); bArrList.Add(button2); bArrList.Add(button1); parameterList = new ArrayList(); } private void SetParameterList() { int i, I = bArrList.Count ; parameterList.Clear(); for (i = 0; i < I; i++) { parameterList.Add(int.Parse(((Button)bArrList[i]).Text)); } f1.formDecimalValue(parameterList); } public void SetButtons(ArrayList lst) { int i, I = lst.Count, J = bArrList.Count; for (i = 0; i < J; i++) { ((Button)bArrList[i]).Text = "0"; } for (i = 0; i < I; i++) { ((Button)bArrList[i]).Text = ((int)lst[i]).ToString(); } } // Clean up any resources being used. protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Component Designer generated code // Required method for Designer support – do not modify // the contents of this method with the code editor. private void InitializeComponent() { this.panel1 = new System.Windows.Forms.Panel(); this.button16 = new System.Windows.Forms.Button(); this.button15 = new System.Windows.Forms.Button(); this.button14 = new System.Windows.Forms.Button(); this.button13 = new System.Windows.Forms.Button(); this.button12 = new System.Windows.Forms.Button(); this.button11 = new System.Windows.Forms.Button(); this.button10 = new System.Windows.Forms.Button(); this.button9 = new System.Windows.Forms.Button(); this.button8 = new System.Windows.Forms.Button(); this.button7 = new System.Windows.Forms.Button(); this.button6 = new System.Windows.Forms.Button(); this.button5 = new System.Windows.Forms.Button(); this.button4 = new System.Windows.Forms.Button(); this.button3 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button(); this.panel1.SuspendLayout(); this.SuspendLayout(); // // panel1 // this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.panel1.Controls.Add(this.button16); this.panel1.Controls.Add(this.button15); this.panel1.Controls.Add(this.button14); this.panel1.Controls.Add(this.button13); this.panel1.Controls.Add(this.button12); this.panel1.Controls.Add(this.button11); this.panel1.Controls.Add(this.button10); this.panel1.Controls.Add(this.button9); this.panel1.Controls.Add(this.button8); this.panel1.Controls.Add(this.button7); this.panel1.Controls.Add(this.button6); this.panel1.Controls.Add(this.button5); this.panel1.Controls.Add(this.button4); this.panel1.Controls.Add(this.button3); this.panel1.Controls.Add(this.button2); this.panel1.Controls.Add(this.button1); this.panel1.Location = new System.Drawing.Point(8, 8); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(648, 48); this.panel1.TabIndex = 0; // // button16 // this.button16.Location = new System.Drawing.Point(605, 12); this.button16.Name = "button16"; this.button16.Size = new System.Drawing.Size(32, 23); this.button16.TabIndex = 146; this.button16.Text = "0"; this.button16.Click += new System.EventHandler(this.buttonX_Click); // // button15 // this.button15.Location = new System.Drawing.Point(565, 12); this.button15.Name = "button15"; this.button15.Size = new System.Drawing.Size(32, 23); this.button15.TabIndex = 145; this.button15.Text = "0"; this.button15.Click += new System.EventHandler(this.buttonX_Click); // // button14 // this.button14.Location = new System.Drawing.Point(525, 12); this.button14.Name = "button14"; this.button14.Size = new System.Drawing.Size(32, 23); this.button14.TabIndex = 144; this.button14.Text = "0"; this.button14.Click += new System.EventHandler (this.buttonX_Click); // // button13 // this.button13.Location = new System.Drawing.Point(485, 12); this.button13.Name = "button13"; this.button13.Size = new System.Drawing.Size(32, 23); this.button13.TabIndex = 143; this.button13.Text = "0"; this.button13.Click += new System.EventHandler (this.buttonX_Click); // // button12 // this.button12.Location = new System.Drawing.Point(445, 12); this.button12.Name = "button12"; this.button12.Size = new System.Drawing.Size(32, 23); this.button12.TabIndex = 142; this.button12.Text = "0"; this.button12.Click += new System.EventHandler (this.buttonX_Click); // // button11 // this.button11.Location = new System.Drawing.Point(405, 12); this.button11.Name = "button11"; this.button11.Size = new System.Drawing.Size(32, 23); this.button11.TabIndex = 141; this.button11.Text = "0"; this.button11.Click += new System.EventHandler (this.buttonX_Click); // // button10 // this.button10.Location = new System.Drawing.Point(365, 12); this.button10.Name = "button10"; this.button10.Size = new System.Drawing.Size(32, 23); this.button10.TabIndex = 140; this.button10.Text = "0"; this.button10.Click += new System.EventHandler (this.buttonX_Click); // // button9 // this.button9.Location = new System.Drawing.Point(325, 12); this.button9.Name = "button9"; this.button9.Size = new System.Drawing.Size(32, 23); this.button9.TabIndex = 139; this.button9.Text = "0"; this.button9.Click += new System.EventHandler (this.buttonX_Click); // // button8 // this.button8.Location = new System.Drawing.Point(285, 12); this.button8.Name = "button8"; this.button8.Size = new System.Drawing.Size(32, 23); this.button8.TabIndex = 138; this.button8.Text = "0"; this.button8.Click += new System.EventHandler(this.buttonX_Click); // // button7 // this.button7.Location = new System.Drawing.Point(245, 12); this.button7.Name = "button7"; this.button7.Size = new System.Drawing.Size(32, 23); this.button7.TabIndex = 137; this.button7.Text = "0"; this.button7.Click += new System.EventHandler(this.buttonX_Click); // // button6 // this.button6.Location = new System.Drawing.Point(205, 12); this.button6.Name = "button6"; this.button6.Size = new System.Drawing.Size(32, 23); this.button6.TabIndex = 136; this.button6.Text = "0"; this.button6.Click += new System.EventHandler(this.buttonX_Click); // // button5 // this.button5.Location = new System.Drawing.Point(165, 12); this.button5.Name = "button5"; this.button5.Size = new System.Drawing.Size(32, 23); this.button5.TabIndex = 135; this.button5.Text = "0"; this.button5.Click += new System.EventHandler(this.buttonX_Click); // // button4 // this.button4.Location = new System.Drawing.Point(125, 12); this.button4.Name = "button4"; this.button4.Size = new System.Drawing.Size(32, 23); this.button4.TabIndex = 134; this.button4.Text = "0"; this.button4.Click += new System.EventHandler (this.buttonX_Click); // // button3 // this.button3.Location = new System.Drawing.Point(85, 12); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(32, 23); this.button3.TabIndex = 133; this.button3.Text = "0"; this.button3.Click += new System.EventHandler (this.buttonX_Click); // // button2 // this.button2.Location = new System.Drawing.Point(45, 12); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(32, 23); this.button2.TabIndex = 132; this.button2.Text = "0"; this.button2.Click += new System.EventHandler (this.buttonX_Click); // // button1 // this.button1.Location = new System.Drawing.Point(5, 12); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(32, 23); this.button1.TabIndex = 131; this.button1.Text = "0"; this.button1.Click += new System.EventHandler(this.buttonX_Click); // // ButtonsControl // this.Controls.Add(this.panel1); this.Name = "ButtonsControl"; this.Size = new System.Drawing.Size(664, 64); this.panel1.ResumeLayout(false); this.ResumeLayout(false); } #endregion private void buttonX_Click(object sender, System.EventArgs e) { if (((Button)sender).Text.Equals("0")) ((Button)sender).Text = "1"; else ((Button)sender).Text = "0"; SetParameterList(); } } }