public void InputBox() { var sut = new InputBox("Question?", "Input"); sut.Show(); sut.Close(); Assert.IsTrue(string.IsNullOrEmpty(sut.Answer)); }
private static string IB(string prompt, string title, string defaultValue) { InputBox ib = new InputBox(); ib.FormPrompt = prompt; ib.FormCaption = title; ib.DefaultValue = defaultValue; ib.ShowDialog(); string s = ib.InputResponse; ib.Close(); return s; }
private void btAdd_Click(object sender, EventArgs e) { if ((this.targetControl != null) && !string.IsNullOrEmpty(this.targetControl.Text)) { InputBox box = new InputBox(string.Format("请输入常用语:{0}\r\n的易记性标题:", this.targetControl.Text), "请输入常用语标题", (this.targetControl.Text.Length > 10) ? this.targetControl.Text.Substring(0, 10) : this.targetControl.Text); if (box.ShowDialog(base.FindForm()) == DialogResult.OK) { if (!string.IsNullOrEmpty(box.Result)) { this.Add(box.Result, this.targetControl.Text); } else { MessageHelper.ShowInfo("常用语标题没有输入!"); } } box.Close(); } }