.net2.0窗体关闭时自动保存窗体位置及大小

.net2.0为我们准备好了。
窗体属性中 (ApplicationSettings) - (PropertyBinding) 点击按钮。
点开Location新建,输入自己的设置名称,我设置的是MyLocation。
同样也新建一个MyClientSize,然后OK。
再打开您的Project属性里面的设定选项卡,看到我们刚才的MyLocation,MyClientSize。
然后看代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace SaveWindowSizeAndLocation
{
    
public partial class Form1 : Form
    {
        
public Form1()
        {
            InitializeComponent();
        }

        
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            Properties.Settings.Default.Save();
        }
    }
}
郁闷,我的博客出了BUG。

posted on 2006-07-22 18:02  萝卜青菜  阅读(419)  评论(1编辑  收藏  举报

导航