using System;

  using System.Collections.Generic;

  using System.ComponentModel;

  using System.Data;

  using System.Drawing;

  using System.Linq;

  using System.Text;

  using System.Windows.Forms;

  using System.IO;

  namespace 记录对话框的位置

  {

  public partial class Form1 : Form

  {

  public Form1()

  {

  InitializeComponent();

  }

  private void Form1_ClientSizeChanged(object sender, EventArgs e)

  {

  int x = this.Width;

  int y = this.Height;

  File.WriteAllLines(@"p.txt", new string[] { x.ToString(), y.ToString() });

  }

  private void Form1_Load(object sender, EventArgs e)

  {

  string[] si = File.ReadAllLines("p.txt");

  this.Width = Convert.ToInt32(si[0]);

  this.Height = Convert.ToInt32(si[1]);

  string[] po = File.ReadAllLines("location.txt");

  Point p = new Point();

  p.X = Convert.ToInt32(po[0]);

  p.Y = Convert.ToInt32(po[1]);

  this.Location = p;

  }

  private void Form1_FormClosed(object sender, FormClosedEventArgs e)

  {

  Point p = new Point();

  p = this.Location;

  File.WriteAllLines("location.txt", new string[] { p.X.ToString(), p.Y.ToString() });

  }

  }

  }