示例#1
0
        private void toolStripMenuItemNew_Click(object sender, EventArgs e)
        {
            //Create a new note - need to add as a child to the FormServiceNotes form
            Form note = new FormNote();

            //Make the parent the service notes form
            note.MdiParent = this;

            //Actually show the individual note
            note.Show();
        }
示例#2
0
        private void toolStripMenuItemOpen_Click(object sender, EventArgs e)
        {
            //Create a new instance of the note child object
            FormNote note = new FormNote();

            //Make this a child form
            note.MdiParent = this;


            //Use the OpenFileDialog and a new instance of Note to display a file specified by the user
            OpenFileDialog openFileDialog = new OpenFileDialog();

            //If the result of the OpbenFileDialog experience was "OK"
            if (openFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                //stream reader?
                StreamReader streamReader = new StreamReader(openFileDialog.FileName);

                //Bring the contents in from the streamReader and change the title of the small note window
                note.NoteContents = streamReader.ReadToEnd();
                note.Text         = openFileDialog.FileName.ToString();
                note.Show();
            }
        }