次のキーワードを追加して、ユーザー データをシリアライズ可能にします。
[Serializable]
データ構造の上。ダイアログ ボックスをロードするときは、シリアル化された構造をディスクからロードし、ダイアログを終了するときは、データ構造を保存します。
スタイルの観点からは、ダイアログ ボックスが閉じられるまで (モーダルの場合)、ダイアログ ボックスのデータを変更するべきではありません。
保存する:
    private bool Save(String inFileName, MyObject inObject){
        try {
            FileStream theStream = File.Open(inFileName, FileMode.Create);
            BinaryFormatter theFormatter = new BinaryFormatter();
            theFormatter.Serialize(theStream, inObject);//add it to the end there
            theStream.Dispose();
            theStream.Close();
        } catch{
            return false;
        }
        return true;
    }
ロードするには:
    private MyObject Read(String inFileName){
        MyObject theReturn = null;
        try {
            FileStream theStream = File.Open(inFileName, FileMode.Open, FileAccess.Read);                
            BinaryFormatter theFormatter = new BinaryFormatter();
            theReturn = (CImageData)theFormatter.Deserialize(theStream);//add it to the end there
            theStream.Dispose();
            theStream.Close();
        }
        catch {
            return null;
        }
        return theReturn;
    }
ストリームで 'using' を使用することもできますが、このコードはかなり単純だと思います。また、MyObject にさらに項目を追加できることも意味します。
編集:暗号化のために、AESまたは同様のものを追加できます。ファイルをバイナリとして保存すると、メモ帳などで読み取ることができますが、簡単に編集することはできません。実際の暗号化に関する長い説明は次のとおりです。
http://msdn.microsoft.com/en-us/magazine/cc164055.aspx