我保存我的应用程序的位置,但它不想保留值。现在代码中发生的事情是_FormClosing
变灰,并且“从未使用过”。有没有人可以看到我下面的代码出错了?Form1_FormClosing方法'从来没有使用',设置不保存
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
if (Settings.Default.WindowLocation != null)
this.Location = Settings.Default.WindowLocation;
this.txtInput60.KeyPress += new System.Windows.Forms.KeyPressEventHandler(CheckEnterKeyPress);
}
private void Form1_FormClosing(object sender, FormClosedEventArgs e)
{
Settings.Default.WindowLocation = this.Location;
Settings.Default.Save();
}
private void CheckEnterKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Return)
{
decimal minutes;
decimal.TryParse(txtInput60.Text, out minutes);
if (minutes > 0)
{
var total = (int) (minutes/60*100);
txtOutput100.Text = total.ToString();
Clipboard.SetText(total.ToString());
}
}
}
在我的应用程序性能我与WindowLocation,system.draw.point,用户,0设置WindowLocation; 0
请更改标题到更合适的和描述性的东西。目前的标题太笼统了。 – 2011-12-19 13:07:56