本文整理汇总了C#中System.Windows.Forms.Form.Close方法的典型用法代码示例。如果您正苦于以下问题:C# System.Windows.Forms.Form.Close方法的具体用法?C# System.Windows.Forms.Form.Close怎么用?C# System.Windows.Forms.Form.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Form
的用法示例。
在下文中一共展示了System.Windows.Forms.Form.Close方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: loginmenu
/// <summary>
/// Wywoluje powitalne okno, gdzie uzytkownik moze podac swoje imie.
/// </summary>
private void loginmenu()
{
System.Windows.Forms.Form prompt = new System.Windows.Forms.Form();
prompt.Width = 300;
prompt.Height = 150;
prompt.Text = "Welcome!!!";
prompt.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
System.Windows.Forms.Label textLabel = new System.Windows.Forms.Label() { Left = 50, Top = 20, Text = "Enter your name" };
System.Windows.Forms.TextBox textBox = new System.Windows.Forms.TextBox() { Left = 50, Top = 50, Width = 200, Text = "Player" };
System.Windows.Forms.Button confirmation = new System.Windows.Forms.Button() { Text = "Ok", Left = 150, Width = 100, Top = 70 };
confirmation.Click += (sender, e) => { prompt.Close(); };
prompt.Controls.Add(confirmation);
prompt.Controls.Add(textLabel);
prompt.Controls.Add(textBox);
prompt.ShowDialog();
PlayerName = textBox.Text;
}
示例2: ShowEvents
public bool ShowEvents(List<Tuple<Income, DateTime>> events)
{
string s = "";
foreach (var t in events)
{
s += String.Format("{2} {0} {1} {3}\r\n", t.Item1.Name, t.Item1.Amount, t.Item2, t.Item1.Period2.Format);
}
var f = new System.Windows.Forms.Form();
var tb = new System.Windows.Forms.TextBox();
tb.Multiline = true;
tb.Dock = System.Windows.Forms.DockStyle.Fill;
tb.Text = s;
tb.ScrollBars = System.Windows.Forms.ScrollBars.Both;
f.Controls.Add(tb);
var b = new System.Windows.Forms.Button();
b.Dock = System.Windows.Forms.DockStyle.Top;
b.Text = "OK";
f.Controls.Add(b);
b.Click += delegate(object o, EventArgs e) { f.DialogResult = System.Windows.Forms.DialogResult.OK; f.Close(); };
return f.ShowDialog() == System.Windows.Forms.DialogResult.OK;
}