private void Answer_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != '\0') { Chocie_finish.Show(); } }
private void button1_Click(object sender, EventArgs e) { if (option_count == 'Z') { MessageBox.Show("超出选项数量限制!!!"); return; } if (option_count == 'A') { this.Chocie_up = new System.Windows.Forms.Button(); this.textBox1.Location = new System.Drawing.Point(181, 250); this.textBox1.Multiline = true; this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(235, 39); this.textBox1.TabIndex = 3; textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.textBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress); //textbox2 // this.textBox2.BackColor = System.Drawing.SystemColors.ScrollBar; this.textBox2.Enabled = true; this.textBox2.Font = new System.Drawing.Font("楷体", 13.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.textBox2.Location = new System.Drawing.Point(142, 250); this.textBox2.Name = "textBox2"; this.textBox2.Size = new System.Drawing.Size(30, 34); this.textBox2.TabIndex = 3; this.textBox2.Text = option_count.ToString(); this.textBox2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; // Chocie_up // this.Chocie_up.Font = new System.Drawing.Font("幼圆", 10.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.Chocie_up.Location = new System.Drawing.Point(420, 250); this.Chocie_up.Name = "Chocie_up"; this.Chocie_up.Size = new System.Drawing.Size(50, 30); this.Chocie_up.TabIndex = 3; this.Chocie_up.Text = "确认"; this.Chocie_up.UseVisualStyleBackColor = true; this.Chocie_up.Click += new System.EventHandler(this.Chocie_up_Click); this.Controls.Add(this.Chocie_up); this.Controls.Add(this.textBox1); this.Controls.Add(this.textBox2); Chocie_up.Visible = false; } else { this.textBox2.Text = option_count.ToString(); choice.Add(this.textBox1.Text); this.textBox1.Text = ""; Chocie_finish.Show(); //Choice_Show Choice_Show.Show(); Choice_Show.AppendText(option_show.ToString() + "." + choice[sum] + "\n"); // Choice_Show.Text += ( option_show.ToString()+"."+ choice[sum]+"\n"); body += (option_show.ToString() + "." + choice[sum] + "##"); option_show++; } option_count++; //记录按钮点击次数 sum++; //增加选项个数计数 }