how to open a file implicitly when application invokes

คำถาม how to open a file implicitly when application invokes

  • 10 เมษายน 2549 12:14
     
     

     

     hi,

          my intention : to open the image in the picture box in another application(image viewer ) automatically when ever user presses edit button.

       problem : i am getting the image viewer application running but i am not able to get the image running at the same time.

    could anyone pls help me in solving this i am running out of time.....

     

    regards

    praveen

    private void  editToolStripButton_Click(object sender, EventArgs e)

    {

    IPLab.MainForm form1 = new IPLab.MainForm();

    form1.Visible = true;

    }

     

     

ตอบทั้งหมด

  • 10 เมษายน 2549 16:29
     
     

    all your code is doing is making a form visible?  Theres gotta be more than this...

    can you provide some more code, maybe the code that actually shows the PictureViewer and loads a file?

     

     

  • 11 เมษายน 2549 9:09
    ผู้ดูแล
     
     
    I don't understand your question, you want to get an image that is shown in a other application and draw this in your own application?

    What have you tried, because the code you post doesn't contain any of this logic.
  • 11 เมษายน 2549 10:07
     
     

    This is the code to open a file with open dialog box in a separate application called imageviewer which is out side my project...

    I am instatiating a new main form which consists all the code to invoke image viewer application,the iplab.mainform implements Idocumentshost which is  an interface class now i have a picture box in my form and my intention is whenever user presses edit---> the imageviewer application that is ip.mainform has to invoke with the image which is in the picture box of my form and it should open outside my form allowing user to edit the stuff.

     

    This is the mainform of imageviewer which has all the code to invoke the imageviewer application

    namespace IPLab

    {

    /// <summary>

    /// Summary description for Form1.

    /// </summary>

    public class MainForm : System.Windows.Forms.Form, IDocumentsHost

    {

    private void OpenFile()

    {

    if (ofd.ShowDialog() == DialogResult.OK)

    {

    ImageDoc imgDoc = null;

    try

    {

    // create image document

    imgDoc = new ImageDoc(ofd.FileName, (IDocumentsHost) this);

    imgDoc.Text = Path.GetFileName(ofd.FileName);

    }

    catch (ApplicationException ex)

    {

    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

    }

    if (imgDoc != null)

    {

    imgDoc.Show(dockManager);

    imgDoc.Focus();

    // set events

    SetupDocumentEvents(imgDoc);

    }

    }

    }

    }

    }

     

     

    namespace IPLab

    {

    using System;

    using System.Drawing;

    using System.Drawing.Imaging;

    using AForge.Imaging;

    /// <summary>

    /// IDocumentsHost interface

    /// Provides connectione between documents and the main widnow

    /// </summary>

    public interface IDocumentsHost

    {

    bool CreateNewDocumentOnChange{get;}

    bool RememberOnChange{get;}

    bool NewDocument(Bitmap image);

    bool NewDocument(ComplexImage image);

    Bitmap GetImage(object sender, String text, Size size, PixelFormat format);

    }

    }

    This is my form which has all code to invoke to scan interface form and from this form i have invoke imageviewer ( iplab.mainform ) and open the image file in the picture box of this form in imageviewer application implicitly

     

    namespace ClinicalChart

    {

    public partial class ScanningInterface : Form

    {

    private void editToolStripButton_Click(object sender, EventArgs e)

    {

    IPLab.MainForm form1 = new IPLab.MainForm();

    form1.Visible = true;

    }

    }

    }

     

    thanks,

    praveen

  • 12 เมษายน 2549 9:26
    ผู้ดูแล
     
     
    You are opening an third-party application to view your image, but now you want to react on that application when a other image is selected, do i understand this correctly?