private void formulaToolStripMenuItem_Click(object sender, EventArgs e) { var dialogform = new GetFormulaPopup(); if (dialogform.ShowDialog() == System.Windows.Forms.DialogResult.OK) { //HtmlElement userimage = editor.webBrowser1.Document.CreateElement("img"); //userimage.SetAttribute("src", Path.Combine(Path.GetTempPath(), "Eq2ImgWinForms.gif")); //userimage.Id = Guid.NewGuid().ToString(); Point p = new Point(); GetCaretPos(ref p); // StreamReader sm = new StreamReader(Path.Combine(dialogform.tempGifFilePath, "")); string aImg = "<IMG border=0 hspace=0 alt='' src='" + GetImage(dialogform.tempGifFilePath) + "'align=baseline>"; switch (myenum) { case MyEnum.EnglishQuestion: var CurrentSelectedsLocation = (mshtml.IHTMLTxtRange)editor.doc.selection.createRange(); CurrentSelectedsLocation.pasteHTML(aImg); // HtmlElement currentElement = editor.webBrowser1.Document.GetElementFromPoint(p); // currentElement.InsertAdjacentElement(HtmlElementInsertionOrientation.AfterBegin, (HtmlElement)aImg); //editor.webBrowser1.Document.Body.AppendChild(userimage); //editor.BodyHtml = editor.BodyHtml + aImg; break; case MyEnum.EnglishOption1: var CurrentSelectedsLocationEN1 = (mshtml.IHTMLTxtRange)editorEN1.doc.selection.createRange(); CurrentSelectedsLocationEN1.pasteHTML(aImg); // editorEN1.BodyHtml = editorEN1.BodyHtml + aImg; // editorEN1.webBrowser1.Document.Body.AppendChild(userimage); break; case MyEnum.EnglishOption2: var CurrentSelectedsLocationEN2 = (mshtml.IHTMLTxtRange)editorEN2.doc.selection.createRange(); CurrentSelectedsLocationEN2.pasteHTML(aImg); // editorEN2.BodyHtml = editorEN2.BodyHtml + aImg; // editorEN2.webBrowser1.Document.Body.AppendChild(userimage); break; case MyEnum.EnglishOption3: var CurrentSelectedsLocationEN3 = (mshtml.IHTMLTxtRange)editorEN3.doc.selection.createRange(); CurrentSelectedsLocationEN3.pasteHTML(aImg); //editorEN3.BodyHtml = editorEN3.BodyHtml + aImg; //editorEN3.webBrowser1.Document.Body.AppendChild(userimage); break; case MyEnum.EnglishOption4: var CurrentSelectedsLocationEN4 = (mshtml.IHTMLTxtRange)editorEN4.doc.selection.createRange(); CurrentSelectedsLocationEN4.pasteHTML(aImg); // editorEN4.BodyHtml = editorEN4.BodyHtml + aImg; // editorEN4.webBrowser1.Document.Body.AppendChild(userimage); break; case MyEnum.HindiQuestion: // HtmlElement currentElement1 = editor1.webBrowser1.Document.GetElementFromPoint(p); //currentElement1.Id // .InsertAdjacentElement(HtmlElementInsertionOrientation.AfterBegin, userimage); // editor1.webBrowser1.Document.Body.AppendChild(userimage); var CurrentSelectedsLocationHI = (mshtml.IHTMLTxtRange)editor.doc.selection.createRange(); CurrentSelectedsLocationHI.pasteHTML(aImg); //editor1.BodyHtml = editor1.BodyHtml + aImg; break; case MyEnum.HindiOption1: var CurrentSelectedsLocationHI1 = (mshtml.IHTMLTxtRange)editorHI1.doc.selection.createRange(); CurrentSelectedsLocationHI1.pasteHTML(aImg); //editorHI1.BodyHtml = editorHI1.BodyHtml + aImg; // editorHI1.webBrowser1.Document.Body.AppendChild(userimage); break; case MyEnum.HindiOption2: var CurrentSelectedsLocationHI2 = (mshtml.IHTMLTxtRange)editorHI2.doc.selection.createRange(); CurrentSelectedsLocationHI2.pasteHTML(aImg); //editorHI2.BodyHtml = editorHI2.BodyHtml + aImg; //editorHI2.webBrowser1.Document.Body.AppendChild(userimage); break; case MyEnum.HindiOption3: var CurrentSelectedsLocationHI3 = (mshtml.IHTMLTxtRange)editorHI3.doc.selection.createRange(); CurrentSelectedsLocationHI3.pasteHTML(aImg); //editorHI3.BodyHtml = editorHI3.BodyHtml + aImg; // editorHI3.webBrowser1.Document.Body.AppendChild(userimage); break; case MyEnum.HindiOption4: var CurrentSelectedsLocationHI4 = (mshtml.IHTMLTxtRange)editorHI4.doc.selection.createRange(); CurrentSelectedsLocationHI4.pasteHTML(aImg); //editorHI4.BodyHtml = editorHI4.BodyHtml + aImg; //editorHI4.webBrowser1.Document.Body.AppendChild(userimage); break; default: MsgBox.Show("Please Select a Question or Answer first", "No selected Box Fount", MsgBox.Buttons.OK, MsgBox.Icon.Info, MsgBox.AnimateStyle.ZoomIn); break; } } }
private void formulaToolStripMenuItem_Click(object sender, EventArgs e) { var dialogform = new GetFormulaPopup(); if (dialogform.ShowDialog() == System.Windows.Forms.DialogResult.OK) { //HtmlElement userimage = editor.webBrowser1.Document.CreateElement("img"); //userimage.SetAttribute("src", Path.Combine(Path.GetTempPath(), "Eq2ImgWinForms.gif")); //userimage.Id = Guid.NewGuid().ToString(); Point p = new Point(); GetCaretPos(ref p); // StreamReader sm = new StreamReader(Path.Combine(dialogform.tempGifFilePath, "")); var aImg = "<IMG border=0 hspace=0 alt='' src='" + GetImage(dialogform.tempGifFilePath) + "'align=baseline>"; switch (myenum) { case MyEnum.EnglishQuestion: // HtmlElement currentElement = editor.webBrowser1.Document.GetElementFromPoint(p); // currentElement.InsertAdjacentElement(HtmlElementInsertionOrientation.AfterBegin, userimage); //editor.webBrowser1.Document.Body.AppendChild(userimage); editor.BodyHtml = editor.BodyHtml + aImg; break; case MyEnum.EnglishOption1: editorEN1.BodyHtml = editorEN1.BodyHtml + aImg; // editorEN1.webBrowser1.Document.Body.AppendChild(userimage); break; case MyEnum.EnglishOption2: editorEN2.BodyHtml = editorEN2.BodyHtml + aImg; // editorEN2.webBrowser1.Document.Body.AppendChild(userimage); break; case MyEnum.EnglishOption3: editorEN3.BodyHtml = editorEN3.BodyHtml + aImg; //editorEN3.webBrowser1.Document.Body.AppendChild(userimage); break; case MyEnum.EnglishOption4: editorEN4.BodyHtml = editorEN4.BodyHtml + aImg; // editorEN4.webBrowser1.Document.Body.AppendChild(userimage); break; case MyEnum.HindiQuestion: // HtmlElement currentElement1 = editor1.webBrowser1.Document.GetElementFromPoint(p); //currentElement1.Id // .InsertAdjacentElement(HtmlElementInsertionOrientation.AfterBegin, userimage); // editor1.webBrowser1.Document.Body.AppendChild(userimage); editor1.BodyHtml = editor1.BodyHtml + aImg; break; case MyEnum.HindiOption1: editorHI1.BodyHtml = editorHI1.BodyHtml + aImg; // editorHI1.webBrowser1.Document.Body.AppendChild(userimage); break; case MyEnum.HindiOption2: editorHI2.BodyHtml = editorHI2.BodyHtml + aImg; //editorHI2.webBrowser1.Document.Body.AppendChild(userimage); break; case MyEnum.HindiOption3: editorHI3.BodyHtml = editorHI3.BodyHtml + aImg; // editorHI3.webBrowser1.Document.Body.AppendChild(userimage); break; case MyEnum.HindiOption4: editorHI4.BodyHtml = editorHI4.BodyHtml + aImg; //editorHI4.webBrowser1.Document.Body.AppendChild(userimage); break; default: MessageBox.Show("Please Select a Question or Answer first"); break; } } }