コード例 #1
0
        /// <summary>
        /// Description: Open a file from the web
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void openFromWebToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogOpenWeb dialog = new DialogOpenWeb();

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    WebRequest  request  = WebRequest.Create(dialog.Url);
                    WebResponse response = request.GetResponse();

                    Image     image = Image.FromStream(response.GetResponseStream());
                    FormChild child = new FormChild();
                    child.Image                     = image;
                    child.MdiParent                 = this;
                    child.FormClosing              += new System.Windows.Forms.FormClosingEventHandler(childClosing);
                    saveToolStripMenuItem.Enabled   = true;
                    saveAsToolStripMenuItem.Enabled = true;
                    child.Show();
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// Description: Open a file from the file explorer
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void openFromFileToolStripMenuItem_Click(object sender, EventArgs e)
 {
     openFileDialog1.Filter      = "Image Files (*.jpg, *.jpeg, *.bmp, *.gif)|*.jpg; *.jpeg; *.bmp; *.gif|All Files (*.*)|*.*";
     openFileDialog1.FilterIndex = 1;
     if (openFileDialog1.ShowDialog() == DialogResult.OK)
     {
         FormChild child = new FormChild(openFileDialog1.FileName);
         child.Url                       = openFileDialog1.FileName;
         child.MdiParent                 = this;
         child.FormClosing              += new System.Windows.Forms.FormClosingEventHandler(childClosing);
         saveToolStripMenuItem.Enabled   = true;
         saveAsToolStripMenuItem.Enabled = true;
         child.Show();
     }
 }
コード例 #3
0
 /// <summary>
 /// Description: When the new accelerator is clicked, call a dialog to specify the size of the new childform.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void newToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (DialogNew dialog = new DialogNew())
     {
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             FormChild child = new FormChild(dialog.Resolution);
             child.MdiParent                 = this;
             child.FormClosing              += new System.Windows.Forms.FormClosingEventHandler(childClosing);
             saveToolStripMenuItem.Enabled   = true;
             saveAsToolStripMenuItem.Enabled = true;
             child.Show();
         }
     }
 }