Show a PDF file in a MDI application of C#
-
Hello everybody, I encounter a problem and need your help. In a MDI application of C#, I want to show a PDF file in a child form. I have added a PDF browser to the child form and change it to pulic, just like below: public AxAcroPDFLib.AxAcroPDF pdfBrowser; When the MDI load, my code likes below: Code:
private void MDIFrm_Load(object sender, EventArgs e) { ChildFrm myChildFrm = new ChildFrm(); myChildFrm.pdfBrowser.LoadFile("C:\\dev\\linux-i18n-intro.pdf"); myChildFrm.MdiParent = this; myChildFrm.Show(); }
However,I can not see the PDF content in the Child form,but if I set the ChildFrm as the strartup object,it will show PDF correctly. Could anyone give some suggestions? Thanks very much! Birch -
Hello everybody, I encounter a problem and need your help. In a MDI application of C#, I want to show a PDF file in a child form. I have added a PDF browser to the child form and change it to pulic, just like below: public AxAcroPDFLib.AxAcroPDF pdfBrowser; When the MDI load, my code likes below: Code:
private void MDIFrm_Load(object sender, EventArgs e) { ChildFrm myChildFrm = new ChildFrm(); myChildFrm.pdfBrowser.LoadFile("C:\\dev\\linux-i18n-intro.pdf"); myChildFrm.MdiParent = this; myChildFrm.Show(); }
However,I can not see the PDF content in the Child form,but if I set the ChildFrm as the strartup object,it will show PDF correctly. Could anyone give some suggestions? Thanks very much! BirchI can only guess: maybe the pdfBrowser loads an empty file on Form_Load? Anyway: you should not put the pdfBrowser on a public property - better give the path to the constructor and set it in the form. Anyway he problem seems to be with the pdfBrowser - maybe try using the webbrowser-control to show your files?