//位置情報の保存と復元 //この正規表現で示される値で。例 (Max,0,0,1024,768) 位置に負の値を許すことに注意。 public static MainWindowArgument[] Parse(IWindowPreference pref) { int count = pref.WindowCount; //マッチしないときはデフォルト if (count == 0) { //初期状態で最小化は許さず MainWindowArgument arg = new MainWindowArgument(GetInitialLocation(), FormWindowState.Normal, "", "", 1); return(new MainWindowArgument[] { arg }); } else { //正規表現内のコメント: ソースを表示するフォント次第ではおかしいかも // (<FormWindowState>, left, , top, , width , height ) Regex re = new Regex("\\((Max,|Min,)?\\s*(-?[\\d]+)\\s*,\\s*(-?[\\d]+)\\s*,\\s*([\\d]+)\\s*,\\s*([\\d]+)\\)"); MainWindowArgument[] result = new MainWindowArgument[count]; for (int i = 0; i < count; i++) { string positions = pref.WindowPositionAt(i); Match m = re.Match(positions); GroupCollection gc = m.Groups; Debug.Assert(gc.Count == 6); //自身と子要素5つ //なお、最小化したまま終了しても次回起動時はノーマルサイズで。 result[i] = new MainWindowArgument( ParseRectangle(gc[2].Value, gc[3].Value, gc[4].Value, gc[5].Value), gc[1].Value == "Max," ? FormWindowState.Maximized : FormWindowState.Normal, //カンマつきに注意 pref.WindowSplitFormatAt(i), pref.ToolBarFormatAt(i), pref.TabRowCountAt(i)); } return(result); } }
//位置情報の保存と復元 //この正規表現で示される値で。例 (Max,0,0,1024,768) 位置に負の値を許すことに注意。 public static MainWindowArgument[] Parse(IWindowPreference pref) { int count = pref.WindowCount; //マッチしないときはデフォルト if (count == 0) { //初期状態で最小化は許さず MainWindowArgument arg = new MainWindowArgument(GetInitialLocation(), FormWindowState.Normal, "", "", 1); return new MainWindowArgument[] { arg }; } else { //正規表現内のコメント: ソースを表示するフォント次第ではおかしいかも // (<FormWindowState>, left, , top, , width , height ) Regex re = new Regex("\\((Max,|Min,)?\\s*(-?[\\d]+)\\s*,\\s*(-?[\\d]+)\\s*,\\s*([\\d]+)\\s*,\\s*([\\d]+)\\)"); MainWindowArgument[] result = new MainWindowArgument[count]; for (int i = 0; i < count; i++) { string positions = pref.WindowPositionAt(i); Match m = re.Match(positions); GroupCollection gc = m.Groups; Debug.Assert(gc.Count == 6); //自身と子要素5つ //なお、最小化したまま終了しても次回起動時はノーマルサイズで。 result[i] = new MainWindowArgument( ParseRectangle(gc[2].Value, gc[3].Value, gc[4].Value, gc[5].Value), gc[1].Value == "Max," ? FormWindowState.Maximized : FormWindowState.Normal, //カンマつきに注意 pref.WindowSplitFormatAt(i), pref.ToolBarFormatAt(i), pref.TabRowCountAt(i)); } return result; } }
//�ʒu���̕ۑ��ƕ��� //���̐��K�\���Ŏ������l�ŁB�� (Max,0,0,1024,768) �ʒu�ɕ��̒l��������Ƃɒ��ӁB public static MainWindowArgument[] Parse(IWindowPreference pref) { int count = pref.WindowCount; //�}�b�`���Ȃ��Ƃ��̓f�t�H���g if (count == 0) { //������Ԃōŏ����͋����� MainWindowArgument arg = new MainWindowArgument(GetInitialLocation(), FormWindowState.Normal, "", "", 1); return new MainWindowArgument[] { arg }; } else { //���K�\����̃R�����g: �\�[�X��\������t�H���g����ł͂����������� // (<FormWindowState>, left, , top, , width , height ) Regex re = new Regex("\\((Max,|Min,)?\\s*(-?[\\d]+)\\s*,\\s*(-?[\\d]+)\\s*,\\s*([\\d]+)\\s*,\\s*([\\d]+)\\)"); MainWindowArgument[] result = new MainWindowArgument[count]; for (int i = 0; i < count; i++) { string positions = pref.WindowPositionAt(i); Match m = re.Match(positions); GroupCollection gc = m.Groups; Debug.Assert(gc.Count == 6); //���g�Ǝq�v�f�T�� //�Ȃ��A�ŏ��������܂I�����Ă����N�����̓m�[�}���T�C�Y�ŁB result[i] = new MainWindowArgument( ParseRectangle(gc[2].Value, gc[3].Value, gc[4].Value, gc[5].Value), gc[1].Value == "Max," ? FormWindowState.Maximized : FormWindowState.Normal, //�J���}���ɒ��� pref.WindowSplitFormatAt(i), pref.ToolBarFormatAt(i), pref.TabRowCountAt(i)); } return result; } }